POST
/api/apps/{appId}/payments/auto-payment
200 OK
Charge a stored payment method
Charges a customer who is not present, using a payment method they registered earlier (a payment created with registerAutoPayment: true). This is how subscriptions, renewals and instalments are billed.
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
referenceId |
string | Yes | Your identifier for this charge, and its idempotency key — for a subscription use the invoice number, not the subscription id, so each cycle is a distinct value. |
amount |
number | Yes | Amount to charge, as a decimal in major units with up to two decimal places (10.23). |
autoCapture |
boolean | Yes | Capture immediately, or authorise now and capture later. |
customerOrder |
object | Yes | Same shape as above; customer.customerId identifies whose stored method to use. |
paymentMethodId |
integer | No | Charge one specific stored method. List a customer's methods with the Customers API. |
paymentMethodProviderProfileId |
integer | No | Force a particular provider profile for this charge. |
webhookUrl |
string | No | Per-charge webhook endpoint. |
fraudPolicyId |
integer | No | Override the app's default fraud policy. |
cURL
curl -X POST https://api.paymenthood.com/api/apps/YOUR_APP_ID/payments/auto-payment \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"referenceId": "invoice-2042",
"amount": 9.99,
"autoCapture": true,
"customerOrder": {
"customer": { "customerId": "cus-42", "email": "[email protected]" },
"description": "Monthly plan — August"
}
}'
An auto payment can still fail — expired card, insufficient funds, a provider-side block. Treat the returned state as the result and retry on your own schedule; never assume success because the request returned 200.