Skip to main content
Zero to a working payment in four requests. Use a sk_sandbox_… key · nothing touches real money.
1

Create a product

Omit recurringInterval for a one-time product; set it for a subscription plan.
data.id is your pro_….
2

Open a checkout session

Mint a cs_… token and redirect the buyer to its url.
Test card 4242 4242 4242 4242, any future expiry, any CVC.
3

Register a webhook endpoint

Add your destination in dashboard settings and store the whsec_… secret it shows once · you need it to verify signatures.
4

Grant access

In your handler, verify the signature and grant on the right event · which one depends on the payment method.

Charge without a hosted page

Two calls, in this order, and only for the pay-as-you-go case · metered billing, a top-up, a threshold crossed. 1. Store the card. A setup session takes no amount and charges nothing.
Send the buyer to data.url. Once they are through, read the stored card:
2. Debit it later, with nobody in front of the screen.
A card charge with the buyer present is refused here. Collecting a card needs a page that renders card fields, and that page is ours · so there is no way to hand this endpoint a card token, and no card data ever reaches your servers.

Full API reference

Every parameter and response field.