GladysDevelopers

How payments work

The life of a payment, from creation to capture.

A payment moves through a few states. Each change is announced by webhook, and the payment's status always says where it is.

             payer approves
          (automatic capture)
  CREATED ─────────────────────────────────▶ CAPTURED
     │                                          ▲
     │ payer approves                           │ you capture
     │ (manual capture)                         │
     └──────────────▶ AUTHORIZED ───────────────┘

  CREATED or AUTHORIZED ──▶ CANCELLED   you cancel, or the payer declines
  CREATED               ──▶ EXPIRED     not approved within 15 minutes
  AUTHORIZED            ──▶ EXPIRED     not captured within 7 days
StatusMeans
CREATEDWaiting for the payer to approve it at the checkout_url.
AUTHORIZEDThe payer approved it and the money is held in their wallet, waiting for you to capture it. Manual capture only.
CAPTUREDThe money has moved to your business. Ship the order.
CANCELLEDYou cancelled it, or the payer declined. cancellation_reason says which. Any held money went back to the payer.
EXPIREDNobody finished it in time. Any held money went back to the payer.

CAPTURED, CANCELLED and EXPIRED are final. A captured payment can still be refunded, but it stays CAPTURED.

All monetary fields use major-unit decimal strings.

Creating a payment

curl https://api.joingladys.com/api/v1/payments \
  -H "Authorization: Bearer access_…" \
  -H "Idempotency-Key: order-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "1500.00",
    "description": "Order #1042",
    "merchant_reference": "order_1042",
    "return_url": "https://shop.example/payment-complete",
    "capture_method": "AUTOMATIC",
    "metadata": { "order_id": "1042" }
  }'

Prop

Type

The response is the payment. Send the payer to its checkout_url; see Hosted checkout.

The payment object

Prop

Type

Times are RFC 3339, in UTC. Optional fields are left out when empty.

Time limits

  • Approval: 15 minutes. A payment still CREATED 15 minutes after you made it becomes EXPIRED. Create a new one if the payer comes back later.
  • Capture: 7 days. A manual-capture payment still AUTHORIZED 7 days after approval becomes EXPIRED, and the held money goes back to the payer.

Reading payments

  • GET /payments/{reference} returns one payment. Payments made by other apps are 404.
  • GET /payments lists your app's payments, newest first, with filters on status, environment, capture_method and merchant_reference. See Pagination.

On this page