Payments

Create a payment

Charge a customer once with a single API request, then confirm the payment on your server or in the browser.

Before you start

You need a secret API key from the dashboard. Test keys start with sk_test_ and never move real money, so you can try every request below safely.

Keep secret keys on your server. Use publishable keys in the browser and mobile apps.

Create the payment

Send a POST request with the amount and currency. Attach a customer to show the payment in their history.

Request
curl https://api.acme.dev/v1/payments \
  -u sk_test_acme_demo_key: \
  -d amount=1999 \
  -d currency=usd \
  -d customer=cus_9s6XKzkNRiz8i3 \
  -d description="Pro plan, monthly"

Parameters

NameDescription
amountinteger
RequiredAmount in the smallest currency unit, e.g. 1999 for $19.99.
currencystring
RequiredThree-letter ISO currency code, e.g. usd or eur.
customerstring
ID of an existing customer to attach the payment to.
descriptionstring
Text shown on the receipt and in the dashboard.
metadataobject
Up to 20 key-value pairs for your own reference.

Response

A successful request returns the payment object with status requires_confirmation.

Response
{
  "id": "pay_1NvK2eLkdIwHu7ix",
  "object": "payment",
  "amount": 1999,
  "currency": "usd",
  "customer": "cus_9s6XKzkNRiz8i3",
  "description": "Pro plan, monthly",
  "status": "requires_confirmation",
  "created": 1790345614
}

Next steps

Confirm the payment to charge the customer, or listen to webhooks to track its status.