Authorize and capture
A card payment happens in two moves. Authorization checks the card and holds the funds, Capture moves the funds. You choose whether these happen together or separately withcapture_mode:
INSTANTcaptures the moment authorization succeeds. Use it when you fulfill immediately, like digital goods.MANUALauthorizes now and waits for you to capture later. Ideal when you ship before charging, so you capture on dispatch.
MANUAL is the default. If you send no capture_options, the payment stops at AUTHORIZED and waits for you. The payment object then shows capture_mode: null, not MANUAL.
Between an authorization and capture you can also void if needed to release the hold. After a capture you can refund.
lite doesn’t expire an authorization: an uncaptured payment stays AUTHORIZED. The card issuer releases the hold after its own time limit, typically a few days, so capture or void before then. A late capture may be declined.
Payments are asynchronous
Creating a payment and capturing one return202 Accepted straight away with the payment ID and a status of PENDING, and lite does the work in the background. The 202 means accepted for processing, not succeeded. Void waits for the result and returns VOIDED. Refund returns the payment as it was before the refund. Get the final outcome by retrieving the payment or from your webhook events.
lite sets no time limit on PENDING. Read the payment again with a growing delay between tries, and rely on webhooks for the result. A 3D Secure challenge ends within 15 minutes.
Payment status
A payment reports one of these states. The ones you’ll handle most areREQUIRES_ACTION, AUTHORIZED, CAPTURED, PARTIALLY_CAPTURED, VOIDED, REFUNDED, and FAILED.
After a chargeback, a payment can also show a dispute status:
DISPUTED, DISPUTE_CHALLENGED, ARBITRATION_INITIATED, ARBITRATION_LOST or CHARGEDBACK.
Why a payment failed
ReadGET /payments/{payment_id}?include=operations. The AUTHORIZE operation’s reason, the 3D Secure attempt status in payment.threeds.attempts[], and the gateway’s connector_response_code tell the cases apart:
The webhook’s
data.error carries the same reason.
Before you begin
Complete sandbox setup first: add a test connector or ask lite for one, check you’re in test mode, create a test API key, activate a routing profile pointing at that connector, and enable card payments on your online terminal. Sandbox testing covers each step. All examples callhttps://api.lite.sa with your API key in x-api-key, for test and live alike. See Authentication and environments. Amounts are integer minor units (10000 is 100.00 SAR).
Optionally, use an x-idempotency-key (a UUID) on every create, capture, void, and refund, so a retried request does not charge twice. On create, lite keeps the key for 120 seconds: see Retries and duplicate requests. Add x-correlation-id (a UUID) to trace a request through logs and support.
Create a payment
POST /payments
Required: amount, currency, device and payment_instrument.id. The device block (user agent, screen, timezone, and so on) is mandatory because it feeds 3D Secure and risk assessment. payment_instrument.id is a saved card’s instrument ID: this endpoint doesn’t accept card numbers or encrypted card data.
Key request fields
Response
id. It identifies the payment for every capture, void, refund, and lookup. The create response carries only a self link. GET /payments/{payment_id} adds capture, void and refund links when the payment’s state allows them, which tells you what you can do next. Their href values start with /api/v1/payments, an older route with different authentication, so call the /payments/{payment_id} paths in this guide rather than following them.
Charging a stored card (card on file)
To charge a saved instrument for a subscription or other merchant-initiated payment, reference the instrument and describe the transaction so it stays scheme-compliant:initiator: MERCHANT for payments you trigger without the cardholder present, and CARD_HOLDER when the customer is actively checking out. lite takes the card-on-file agreement from the saved instrument, so the request has no field for it. A merchant-initiated payment still needs the full device block. No 3D Secure runs on it, so send the device details and IP address you recorded when the customer saved the card. To retry a declined charge, create a new payment with the same order.reference at least 60 seconds after the last attempt: lite charges an order only once.
Charge without the customer only a card you stored with an agreement through the instruments API. A card the customer saved at checkout or with an SDK is for payments they make themselves: lite doesn’t block a merchant-initiated charge on it, but the customer didn’t agree to one.
3D Secure
3D Secure asks the card issuer to confirm that the customer is the cardholder. lite runs it inside the payment: there is no separate 3D Secure call to make. On a business account, every customer-present card payment (initiator: CARD_HOLDER, processing_type: REGULAR) runs 3D Secure by default. It never runs for merchant-initiated payments, for CARD_ON_FILE, UNSCHEDULED_CARD_ON_FILE or MOTO payments, or for Apple Pay, which carries its own authentication.
Default. Send the payment without a three_ds block. The payment is REQUIRES_ACTION while lite checks the card with the issuer. If the issuer wants a challenge, GET /payments/{payment_id} returns next_action.redirect.url: send the customer’s browser there. After the challenge, lite sends the customer to your return_info.success page, whatever the result. Read the outcome from your server or from the webhook.
Skip the default. Send three_ds.force: false. Risk checks can still require 3D Secure.
Bring your own result. If you authenticated the card with your own 3D Secure provider, pass the result in three_ds.data when you create the payment. lite then runs no 3D Secure of its own and sends these values with the authorization:
authentication_value, eci, version, ds_transaction_id and trans_status are required. xid is optional, for 3D Secure 1. A MOTO payment can’t carry three_ds.data: that returns 400.
A customer can abandon the challenge and never return. That is not a decline. If they don’t finish within 15 minutes of next_action appearing, the payment moves to FAILED and lite sends payment.failed. Until then, a create with the same order.reference returns this payment.
Capture an authorized payment
POST /payments/{payment_id}/capture
Captures a payment that was authorized with MANUAL. Omit amount to capture everything still uncaptured, or pass a smaller amount for a partial capture. For multiple partial captures, set is_final to true on the last one: the payment then moves to CAPTURED and takes no more captures. is_final goes at the top level of the body; inside metadata it’s ignored.
Void an authorized payment
POST /payments/{payment_id}/void
Reverses an authorization before it is captured, releasing the hold on the customer’s card. Once a payment is captured, void no longer applies, refund instead. The body is optional; include a reason to record why.
Refund a captured payment
POST /payments/{payment_id}/refund
Returns funds after capture. Omit amount to refund the full remaining captured amount, or pass a smaller amount for a partial refund. You can refund multiple times up to the captured total. Any refund moves the payment to REFUNDED. A PARTIALLY_CAPTURED payment can’t be refunded until you close it with a final capture.
Capture, void, and refund each return 202 with a different body, and need their own x-idempotency-key per operation. Payment operations covers the responses, retries, and errors.
Retrieve a payment
GET /payments/{payment_id}
Fetch the current state of a payment. Expand related data with include=instrument,operations, where operations lists the authorizations, captures, voids, and refunds applied so far.
{ payment, next_action, _links }:
next_action.redirect: present only while the payment isREQUIRES_ACTIONand a 3D Secure challenge is waiting. It holdsmethod(GET) andurl. Openurlin the customer’s browser exactly as given: it works for 15 minutes._links.redirect.hrefcarries the same URL.payment.operations, withinclude=operations: the audit trail. Each entry is oneAUTHORIZE,CAPTURE,REFUND,VOID,REVERSEorEXTEND_AUTHORIZATION, with its own status (PENDING/SUCCESS/FAILURE), amount, and the underlying gateway response codes. This is where you see what happened and why a step failed. lite never retries a failed operation for you, soretry_count,max_retriesandnext_retry_atare alwaysnull. To try a declined charge again, create a new payment.
payment_method, the type of instrument used, such as CARD or APPLE_PAY. It can be null. 3D Secure details come back under threeds, even though the request field is three_ds. With include=instrument, the masked card detail (brand, last four, expiry) comes back too.
To find a payment by your own order reference, list payments filtered by it: GET /payments?order_id=ORD-123456. The result uses the list shape, with data[] and pagination_data.
GET /payments lists your payments, newest first, with page and page_size. Filters include status, payment_method, card_brand, processing_type, order_id, customer_id, customer_email, last_four, amount_min, amount_max, from_date and to_date. status, payment_method, card_brand and processing_type take several values separated by commas, such as ?status=AUTHORIZED,CAPTURED. from_date and to_date filter on when the payment was created, both bounds included, and from_date must be earlier than to_date. Send timestamps with a time zone, such as 2026-11-24T21:00:00Z: a bare date means 00:00 UTC, so to_date=2026-11-24 stops at the start of that day. include works on the list too. Unknown filters are ignored, not rejected.
Receive webhooks
Retrieval gives you the state of a payment when you ask for it. Webhooks tell you when it changes, including after the customer has closed the tab. Configure an endpoint under Settings → Developers → Webhooks and subscribe to the events you need:payment.authorized, payment.captured, payment.partially_captured, payment.refunded, payment.voided, payment.failed.
Verify the X-Lite-Signature header against the payload’s data object before you trust a delivery. Store it, return a 2xx, then process it. A delivery can arrive more than once, and lite retries one that fails for up to 7 days: see Create a webhook for retries and how to spot repeats.
Match the event to your order with data.orderId or data.id.
Treat a webhook as a trigger to read the payment server-side, never as proof on its own that money moved. Create a webhook covers signature verification with examples.
Errors
Branch on
errors[].code, not only on the HTTP status.
API errors lists every error code lite returns and the errors returned by each API.
Before you go live
Confirm your integration handles all of these in Test Mode.- A successful payment, end to end
- A declined payment, and each error code above
- A 3D Secure challenge completed, and one abandoned
- The same request retried with the same
x-idempotency-key, charging once - A webhook verified, and the same webhook delivered twice without double-processing
- A payment retrieved by ID and by order reference
- A capture, a partial capture, a final capture with
is_final, a void, and a refund - An action attempted in the wrong state, for example capturing a payment that was never authorized