Docs

Payment Intents

A Payment Intent represents a single payment you want to collect. You create it on your server with the amount and currency, and complete it in the browser with the card.

Create a Payment Intent

Call the API with your secret key. Amounts are in the smallest currency unit (cents):

curl https://checkout.securepayapi.com/api/v1/payment-intents \
  -H "Authorization: Bearer sp_secret_…" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2000,
    "currency": "USD",
    "reference": "order_123"
  }'

The response includes a client_secret:

{
  "id": "abcdef0123456789abcdef01",
  "client_secret": "pi_abcdef0123456789abcdef01_secret_…",
  "amount": 2000,
  "currency": "USD",
  "status": "requires_payment"
}

Pass the client_secret to the embedded checkout widget to collect the card. See the API reference for every field.

The client secret

  • It's the single credential that lets the browser complete this payment — treat it like a password and only send it to your own customer's session.
  • It can't be used to read or change anything else on your account.
  • It's valid for 7 days and can only be paid once.

Payment statuses

StatusMeaning
requires_paymentCreated, waiting for a card
processingThe payment is being completed
succeededPayment captured
failedThe last attempt failed — the customer can retry
expiredThe intent passed its 7-day window

Want to be notified as the status changes? Set up a webhook.

Server is the source of truth

The amount lives on the Payment Intent you created server-side. The browser never sets or changes it, so a customer can't alter what they're charged.

Note

In v1, payments are created in USD. You can also attach a reference, metadata, a statement descriptor, and a description — see the API reference.

© SecurePayAPI · Built with Markdoc