Build against the Sandbox environment first. It mirrors production exactly but moves no real money, so you can replay checkouts and webhooks freely.
What you’ll need
- A Macropay account with an organization
- Next.js 14 or newer, using the App Router
- An organization access token (OAT)
Install the SDK
Add the SDK, the React checkout component, and the webhook verifier:.env.local:
1
Create a product
In Macropay, everything you sell is a product — one-time or recurring share the same API and data model, only the pricing differs. Spin one up in the dashboard or straight from code. Here’s a monthly subscription priced at $24:Keep the
product.id; the next step needs it.2
Send buyers to checkout
A route handler is the cleanest way to mint a checkout on demand. It takes a product ID, opens a hosted checkout session, and redirects the buyer:Point your pricing page at the route and pass the product ID through:The hosted page handles currency localization, theming, and tax collection automatically — VAT and sales tax appear at the right rate for the buyer’s country with no extra work on your side.
3
Embed checkout inline (optional)
To keep buyers on your own page, render the checkout component instead of redirecting:For theming, prefilled fields, and other options, see the embedded checkout reference.
4
Listen for webhooks
Webhooks are how your app learns a payment succeeded so it can grant access. Every Macropay webhook is signed using the Standard Webhooks spec — verify the signature with the The full catalog of event types lives in the webhook events reference.
standardwebhooks library before trusting the payload:5
Test in the sandbox
- Open your checkout page in the browser.
- Pay with the test card
4242 4242 4242 4242, any future expiry, any CVC. - Confirm you land on your
successUrl. - Watch the
order.paidevent arrive in your terminal.
Going to production
Three changes flip you from test to live:Once live, every order automatically carries the correct tax, settles into your Macropay balance, and pays out via ACH or SEPA at no fee. Disputes and chargebacks are handled for you as part of the Merchant of Record service.
Where to go next
All webhook events
Every event type your app can react to
Customer portal
A self-serve page for managing subscriptions
Meter AI & agent usage
Bill by tokens, activity, or outcome — and track agent ROI
Embedded checkout
Theming, prefills, and advanced options