Prerequisites
- Complete Authentication.
- Use only the test data supplied for your current Sandbox account.
- Collect the shopper’s literal IP address and an HTTPS
return_url.
1. Create a Payment
amount, currency, payment_method_data, customer_ip_address, and
return_url are required. Billing details and your customer or reconciliation
references are optional. See the
complete request schema.
2. Inspect the create response
The API returns201 Created with the current Payment state. Store its id
before taking further action.
A card decline is a Payment result, not an HTTP request error. This response
excerpt highlights the fields to inspect; the API reference shows full examples:
3. Complete a browser 3D Secure action when required
Server-side authentication is attempted for every new Direct Payment. A browser redirect is required only when the returned Payment hasstatus: REQUIRES_ACTION and next_action.reason: three_d_secure.
- Redirect the browser to the exact opaque
next_action.redirect_url. - Retrieve the Payment while the browser action is in progress.
- If a later response supplies a different redirect URL, use the latest one.
- When the browser reaches
return_url, retrieve the Payment again; do not treat the return itself as success.
4. Confirm the final status
PENDING, REQUIRES_ACTION, or PROCESSING.
Stop at SUCCEEDED, FAILED, or EXPIRED. Only SUCCEEDED authorizes order
fulfilment.
Safe retries
- Persist the key and non-card fields, but never persist the raw card-data request body. Retry it only while the original body remains available inside your approved PCI handling boundary.
- Card fields are excluded from Direct Payment idempotency. The same key and unchanged non-card fields replay the original Payment even if different card fields are supplied; they do not attempt the different card.
idempotency_key_in_usemeans wait briefly and retry with an equivalent effective request identity.idempotency_key_reusedmeans the key was paired with different non-card fields; resend the original request or use a new key for a genuinely new Payment.- A new card attempt always uses a new key.
- A terminal failed Payment is never resubmitted. A customer retry creates a new Payment with a new key.
Next steps
- Create a Refund after a test Payment succeeds.
- Submit and retrieve a Payout.
- Receive Payment and Refund events.
- Add complete API error handling.