Payments overview
The whole payment flow — Localoy opens a session, your checkout charges through your gateway, your server reports the result, and refunds are recorded.
With Open Network payments you collect the money through your own gateway and Localoy records
the outcome against the order. Localoy never handles card or wallet details. Every call here needs the
PAYMENT scope.
| Endpoint | What it does |
|---|---|
GET /payments/sessions/:id | Reads the session: amount, customer, returnUrl. |
POST …/:id/result | Reports PROCESSING, SUCCEEDED, FAILED or CANCELLED. |
POST …/:id/refund | Records a full refund of a succeeded session. |
The flow#
- Customer → Localoy: Pay for an order
- Localoy → Localoy: Open a payment session
- Localoy → Your server: Redirect ?session_id=…
- Your server → Localoy: GET /payments/sessions/{id}
- Localoy → Your server: amountMinor, returnUrl
- Your server → Your gateway: Charge amountMinor
- Your gateway → Your server: Transaction ID
- Your server → Localoy: POST …/result SUCCEEDED
- Note: Amount and currency checked; order marked paid
- Localoy → Your server: 200 + webhook payment.updated
- Your server → Customer: Redirect to returnUrl
- — Later, if you refund —
- Your server → Your gateway: Refund the charge
- Your server → Localoy: POST …/refund
- Localoy → Your server: 200 session REFUNDED
- Read the session. Your checkout page receives only
session_id. Take the amount from the API, never from the browser. Refuse unlessstatusisPENDINGorPROCESSINGandisExpiredis false. - Charge exactly
amountMinorinBDTand keep your gateway's transaction ID. - Report the result with an
Idempotency-Key.SUCCEEDEDmarks the order paid.FAILED(withfailureCodeandfailureReason) marks it failed and the customer can retry. ASUCCEEDEDwhose amount or currency differs from the session is refused with409and the order is not paid. - Send the customer back to
returnUrlexactly as the session gives it. Nothing in the browser can change a payment. - Refund through your gateway first, then record it. A refund is always for the full amount and
only a
SUCCEEDEDsession can be refunded.
Session statuses#
| From | Can become |
|---|---|
PENDING | PROCESSING, SUCCEEDED, FAILED, CANCELLED, EXPIRED |
PROCESSING | SUCCEEDED, FAILED, CANCELLED, EXPIRED |
FAILED | PROCESSING, SUCCEEDED |
EXPIRED | SUCCEEDED (a charge that completes after expiry is still accepted) |
SUCCEEDED | REFUNDED (refund endpoint only) |
CANCELLED, REFUNDED | Final |
Rules to remember#
- Which orders go through your checkout: event ticket orders, activity bookings, dining reservations, tour bookings, food and store orders, catalogue bookings and package purchases, while your production checkout is enabled.
- A sandbox key sees only sandbox sessions; test sessions change no order and fire no webhook.
Guide: Accept payments, including the checkout settings.