What you’ll need
- A Macropay account with an organization
- Python 3.9 or newer
- An organization access token (the
macropay_oat_…credential)
Run everything against the sandbox first. It mirrors production behavior — webhooks, signatures, the lot — without moving real money.
1. Install and authenticate
Pick your package manager:2. Initialize the client
Point the client atsandbox while you build. The curl tab below reuses the same environment variable for the raw-HTTP examples throughout this guide.
3. Create a checkout session
Create a product once in the dashboard — a one-time license, a monthly plan, whatever you’re selling — then generate a hosted checkout per customer. Macropay’s hosted page handles card entry, 3-D Secure, tax collection, and localization for you.4. Verify and handle webhooks
Macropay signs every webhook using the Standard Webhooks spec, so you can verify authenticity before trusting a payload. Install the verifier:5. Read back orders, subscriptions, and customers
With money flowing, query your data directly from the SDK. Amounts are integers in the smallest currency unit (cents), so divide by 100 to display.6. Test the full loop in sandbox
1
Open the checkout
Run the script from step 3 and open the returned
checkout.url in a browser.2
Pay with a test card
Use
4242 4242 4242 4242 with any future expiry and any CVC, then complete the purchase.3
Confirm the webhook
Watch your FastAPI logs — an
order.paid event should arrive and pass signature verification.Go to production
When the sandbox loop works, switch over:
That’s the whole footprint. Because Macropay is the merchant of record, there’s no separate tax engine to integrate, no PCI questionnaire to fill out, and no dispute workflow to build — those stay on our side of the line.
Where to go next
Bill for AI usage
Meter tokens, activity, or agent outcomes and bill on real consumption
Webhook event reference
Every event type you can subscribe to
Python SDK reference
Full method and model documentation
Self-serve customer portal
Let customers manage plans, invoices, and payment methods