Every object in the API plays a part in one payment's path, from asking for money to the funds in your wallet. Start with the flow, then read up on each object it touches.
How a payment flows
- 01
You ask for money
Your server creates a payment, or you share a payment link.
- 02
The customer opens checkout
Each attempt is a checkout. For crypto, it reserves a fresh address in your wallet and locks the rate.
- 03
Funds arrive
A transfer lands on chain, or a card payment is approved. Checkout follows it until it confirms.
- 04
You hear about it
The payment succeeds, an event is recorded, and your webhook endpoint gets it.
- 05
It lands in your wallet
The money is a transaction in your wallet, and the payer is a customer you can look up.
Businesses
A business is one merchant account, with its own wallet, keys, payments and settings. IDs start with biz_.
- One person can own several businesses.
- A secret key belongs to one business and acts only as it.
- Each business has exactly one wallet, which receives every payment.
Payments
A payment is money you're owed for one thing, at an exact amount in a currency you choose. Its status moves from pending to succeeded, and it has room for your own metadata. IDs start with pmt_.
- One you create through the API has a hosted checkout at its
urland your ownreference. - One made through a link has its
link_idinstead, and aurlofnull.
Checkouts
A checkout is one attempt to pay a payment or link, in one rail, coin and network. IDs start with chk_.
A payment can have several checkouts if the customer changes their mind, but only one can pay it. When the transfer lands on a quote the customer had left, the checkout they moved to closes with replaced_by naming the paid one, so open that one instead.
Remainders
When less than the amount due arrives, the payment becomes underpaid. A remainder is a checkout for exactly what's left, in the same coin and network, attached to the same payment. When the rest arrives, that payment succeeds, and no second payment is made.
Payment links
A link is a reusable checkout with a fixed price. Every customer who pays it creates a new payment that carries the link's link_id. IDs start with lnk_.
Customers
A customer is a person grouped by email, with their payment count and totals. IDs start with cst_.
- One is added as soon as checkout collects an email, so a customer can have no payments yet.
- You can block a customer from paying you.
Events
An event records something that happened, such as payment.succeeded, with a snapshot of the object as it was. Webhooks deliver events, and you can list them any time. IDs start with evt_.
Wallet
Your wallet is self-custody: its recovery phrase is encrypted in your browser and never reaches 402pay. It keeps a balance per coin and network, and every payment's deposit is a wallet transaction. IDs start with wal_ and wtx_.
Next steps
- Accept your first payment in five steps, from a new account to a fulfilled order.
- Authenticate with a secret key, scope it per resource, and keep it safe.
- Create a payment on your server, send the customer to checkout, and fulfill on the webhook.
- Signed events for every change, retried for about 28 hours.