Create a payment
Create a payment for an exact amount and get a hosted checkout URL for it.
Returns 201 with the new payment and its hosted checkout at url. When reference already names a live payment for the same amount and currency, it returns 200 with that payment instead, so a retried create never makes a second one.
Body
amountinteger RequiredThe price in minor units ofcurrency:4900withUSDis $49.00. From the equivalent of $1.00 up to 1,000,000.00 in the currency.currencystringUSD, EUR, GBP, CAD, AUD. Defaults to USD.referencestringYour ID for the payment, such as an order number, up to 64 characters. It names one live payment: one that isn't canceled or expired.descriptionstringShown in the checkout's details and on the receipt, up to 300 characters.customer_emailstringLinks the payment to the customer with this email, adding one if needed. Without it,customer_idstaysnulluntil checkout collects an email.success_urlstringWhere checkout sends the customer after paying, withpayment_idadded to its query. Usehttps://;http://works only forlocalhostand127.0.0.1. Defaults to the redirect in your checkout settings, then the receipt.cancel_urlstringWhere to send the customer if they leave without paying. Usehttps://;http://works only forlocalhostand127.0.0.1.expires_attimestampFrom 15 minutes to 30 days after 402pay receives the request, so give a 15-minute expiry a few seconds' margin. Defaults to 24 hours.metadataobjectfee_payerstringWho pays 402pay's fee on this payment:businessorcustomer. Defaults to your checkout settings. Withcustomer, checkout adds the fee for the method the customer picks to their total, as passing fees on describes.
Errors
- 400
invalid_requestA field is missing or out of range.fieldnames it. - 400
invalid_emailcustomer_emailisn't a valid email address. - 409
reference_in_useThe reference names a live payment for another amount or currency, or one that already received funds. - 403
business_suspended402pay suspended your business, so it can't take new payments. - 403
test_mode_unavailableA test key can't create payments on a live business, so use a live key. - 409
not_acceptingYour business has no wallet yet, so it can't take payments.
Any request can also fail on its key or its body. See errors.
Request
curl -X POST "https://dash.402pay.co/api/v1/payments" \ -H "Authorization: Bearer $PAY402_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 4900, "currency": "USD", "reference": "order_1042", "description": "Pro plan, monthly", "success_url": "https://example.com/thanks", "cancel_url": "https://example.com/cart", "metadata": { "order_id": "1042" } }'Response201 Created
{ "data": { "id": "pmt_QI02vLdJGd48hBbg", "kind": "payment", "status": "pending", "amount": 4900, "currency": "USD", "fee_payer": "business", "customer_fee": 0, "amount_received": 0, "reporting": { "currency": "USD", "amount": 4900, "fee": 0, "transaction_fee": 0, "customer_fee": 0, "net": 0 }, "fee_rate_bps": 0, "method": { "rail": "crypto", "asset": null, "network": null, "amount": null, "expected_amount": null, "overpaid_amount": null, "from_address": null, "tx_hash": null, "explorer_url": null }, "settlement": { "destination": "wallet", "asset": "USDC", "network": "polygon", "amount": "0.00", "wallet_id": null, "address": null, "tx_hash": null, "explorer_url": null }, "customer_id": null, "link_id": null, "url": "https://checkout.402pay.co/checkout/2jrsrcxv7k", "reference": "order_1042", "metadata": { "order_id": "1042" }, "success_url": "https://example.com/thanks", "cancel_url": "https://example.com/cart", "expires_at": "2026-09-27T21:22:47.038Z", "canceled_at": null, "checkout_id": null, "description": "Pro plan, monthly", "country": "", "failure_code": null, "failure_message": null, "confirmed_at": null, "created_at": "2026-09-26T21:22:47.038Z", "updated_at": "2026-09-26T21:22:47.038Z", "events": [ { "type": "created", "created_at": "2026-09-26T21:22:47.038Z", "data": null } ] }}