Install the middleware
Add the Express adapter and Zod:- npm
- yarn
- pnpm
- bun
Terminal
Create the checkout entry route
MountCheckout on a GET route. The middleware resolves the checkout and sends the buyer to it.
Inputs accepted by the checkout route
For example,
?products=123&customerExternalId=user_42 selects a product and ties the session to your application identity.
Create the account-management route
Return the Ruba customer ID for the current application user. The middleware then opens that customer’s portal.Receive signed events
MountWebhooks after JSON parsing. It validates the Ruba signature before invoking your callback.
Choose callback granularity
UseonPayload as a catch-all or register callbacks around the domain your application owns: