Payments
Create, retrieve and list payments; every field.
A payment is one charge of a card. Create it with a card typed by the buyer or a stored card; Duevance routes it to an acquirer, fails over to the next one when that is provably safe, and answers with the payment.
Create a payment
POST /v1/payments (scope write, Idempotency-Key required, counted in the charges bucket)
| Field | Type | Rules |
|---|---|---|
amount | integer | Minor units, 1 to 99 999 999. Required |
currency | string | ISO 4217, such as EUR. Required |
capture | boolean | false only authorizes; capture later. Default true |
card | object | The card typed by the buyer (below). Send card or payment_instrument |
payment_instrument | string | A stored card's id, pm_… (see Card vault) |
initiator | string | With payment_instrument only: merchant (default) or cardholder |
save_card | boolean | Store the card and mint a card-on-file mandate with this charge |
usage | string | recurring, unscheduled or installment: why the card is stored or charged |
require_3ds | boolean | Ask for a 3-D Secure challenge |
reference | string | Your order reference, at most 64 characters, unique per project and environment |
description | string | At most 120 characters |
statement_descriptor | string | 1–25 letters, digits, spaces or & . , - * / # '. Falls back to the project's, then the merchant's |
return_url | string | Where the buyer returns after 3-D Secure. https only (http://localhost is allowed in test mode). At most 2048 characters |
transaction_type | string | Your own classification, at most 24 characters, for reporting |
parent_payment | string | A related earlier payment, pay_…, of this project and environment |
metadata | object | Up to 50 string keys (≤ 40 characters) with string values (≤ 500 characters). Echoed back |
customer | object | reference (≤ 64), email (≤ 255), country (ISO 3166 alpha-2, upper case), ip, user_agent (≤ 512) |
browser | object | What the buyer's browser reports for 3-D Secure: at most 20 fields of strings (≤ 2048), integers or booleans |
card:
| Field | Rules |
|---|---|
number | 12–19 digits, spaces and dashes allowed; must pass the Luhn check and be Visa, Mastercard, Amex, Diners, Discover or JCB |
expiry | MM/YY or MM/YYYY, not in the past |
cvc | 3 digits (4 for Amex). Never stored |
holder | At most 64 characters |
Saving a card (save_card: true) always asks for a 3-D Secure challenge: a mandate is only
minted with the cardholder present.
The answer
| Status | When |
|---|---|
201 | succeeded, authorized, or requires_action with a next_action |
402 | declined (see decline_code) or failed (nothing was charged). The body is the payment |
202 | processing: the acquirer's answer is unknown. Don't charge again: wait for the webhook |
409 | duplicate_reference: the reference is taken; error.payment_id names that payment |
422 | A field is wrong (validation_failed), or no channel takes the charge (routing_unavailable). Nothing was created |
The full status table is on Statuses.
3-D Secure
A payment in requires_action carries:
"next_action": { "type": "redirect_to_url", "url": "https://pay.duevance.com/3ds/att_0D4m…" }
Send the buyer's browser to url. Duevance runs the challenge with the buyer's bank, folds the
answer into the payment, then sends the buyer to your return_url with payment_id added to
its query (https://shop.example/back?payment_id=pay_0D4m…). Without a return_url, the buyer
sees a result page and can close the window. The query proves nothing: confirm the payment
server-side or wait for the webhook. See 3-D Secure.
The payment object
{
"id": "pay_0D4mXqk2…",
"object": "payment",
"environment": "test",
"status": "succeeded",
"amount": 1999,
"currency": "EUR",
"capture": true,
"captured_amount": 1999,
"refunded_amount": 0,
"reference": "order-1001",
"description": null,
"statement_descriptor": "DEMO SHOP",
"decline_code": null,
"decline_category": null,
"card": { "brand": "visa", "last4": "4242" },
"payment_instrument": null,
"checkout_session": null,
"parent_payment": null,
"initiator": "cardholder",
"usage": null,
"transaction_type": null,
"customer": { "email": "[email protected]", "country": "FR" },
"metadata": { "cart": "17" },
"next_action": null,
"authorized_at": "2026-12-03T10:00:00.120Z",
"captured_at": "2026-12-03T10:00:00.120Z",
"canceled_at": null,
"created_at": "2026-12-03T10:00:00.004Z"
}
| Field | Meaning |
|---|---|
status | See Statuses |
captured_amount, refunded_amount | What was captured, and what succeeded refunds returned |
decline_code, decline_category | Why it was declined. decline_category is soft (may succeed later or elsewhere), hard (don't retry this card), three_ds_required or unknown. A routing rule block reads blocked_by_rule:<name> |
card | Brand and last four digits; the number is never returned |
payment_instrument | The stored card charged or saved, pm_… |
initiator | cardholder or merchant, derived from how the card was charged |
next_action | Set while requires_action |
Retrieve a payment
GET /v1/payments/{id} (scope read) answers the payment object, or 404 when no payment of
this project and environment has that id.
List payments
GET /v1/payments (scope read), newest first.
| Parameter | Rules |
|---|---|
status | One status from Statuses |
reference | Your reference, exactly |
created_after | RFC 3339, inclusive, such as 2026-12-01T00:00:00Z |
created_before | RFC 3339, exclusive |
limit | 1 to 100, default 25 |
cursor | next_cursor from the previous page |
{ "object": "list", "data": [ { "id": "pay_…", "object": "payment" } ], "has_more": true, "next_cursor": "eyJ…" }
Pass next_cursor as cursor to get the next page; it is null on the last one. Cursors are
opaque and signed: an altered, truncated or foreign cursor is a 422 with param: "cursor",
never a silent restart at page one. An unknown parameter, or one sent twice, is a 422 too.