Skip to content

Manual Capture

For a payment you create with captureMode: "manual", LydiaGate does not capture the amount after 3D Secure verification. The payment moves to awaiting_capture, and the amount is captured when you call POST /v1/payments/{paymentCode}/capture. This lets you record the order in your own system first and capture afterwards; if the record cannot be saved, no money is taken from the cardholder. Partial capture is not available; the full payment amount is captured.

  1. Add "captureMode": "manual" to the POST /v1/payments request. The response contains captureMode: "manual" and captureDeadline: null. See Create Payment.
  2. Redirect the cardholder to the handoff as usual and let them complete 3D Secure verification. See Card Handoff.
  3. The return to your returnUrl is not a final result. Verify the status with GET /v1/payments/{paymentCode} or a webhook. You do not have to wait for this check: after you save the order, you can call /capture (step 5) directly. If the payment is not yet in awaiting_capture, the request is rejected with 409 payment_not_capturable and no money is taken. With some bank connections the payment moves to awaiting_capture shortly after the return. If you get 409, wait for the payment.authorized webhook or check the status, then repeat the /capture call before captureDeadline.
  4. When the payment moves to awaiting_capture, the payment.authorized webhook is sent and captureDeadline is populated.
  5. Call POST /v1/payments/{paymentCode}/capture right after you save the order. If the order cannot be saved, call POST /v1/payments/{paymentCode}/cancel.
  6. The capture result is captured or failed; the payment.captured or payment.failed webhook follows respectively. If the result is inconclusive, the payment becomes capture_pending; the final result is reported by webhook and can be followed with GET /v1/payments/{paymentCode}. Do not treat a capture_pending payment as failed and do not retry the capture.

Webhook delivery order is not guaranteed. When you receive a webhook, verify the current status of the payment with GET /v1/payments/{paymentCode}.

Manual capture flowThe 6 steps between the cardholder, your server, the LydiaGate API, the LydiaGate 3DS Relay, and the card issuer. After 3D Secure the payment waits in awaiting_capture. Before captureDeadline you capture it with capture or cancel it with cancel. If the deadline passes, LydiaGate closes the payment and it becomes expired. The steps are also listed as text in the numbered list above the diagram.CardholderbrowserYour serveryour payment screenLydiaGate APILydiaGate3DS RelayCard issuer3D SecureOptionsBefore captureDeadline · order savedBefore captureDeadline · order not savedcaptureDeadline passedNo capture · payment becomes awaiting_captureYou save the orderDeadline passes · LydiaGate closes the payment → expired · payment.expired1 POST /v1/payments · captureMode: "manual"paymentRef and handoffUrl2 Card and paymentRef, by form3D Secure verificationVerification result303 redirect3 Arrives at returnUrl3 GET /v1/payments/{paymentCode}awaiting_capture and captureDeadline4 Webhook: payment.authorized5 POST /v1/payments/{paymentCode}/captureBank capture6 captured · payment.captured5 POST /v1/payments/{paymentCode}/cancelcancelled · payment.cancelled
Solid arrows are requests. Dashed arrows are responses. Numbers match the list above. The arrival order of the webhook and the return is not guaranteed. If the capture is rejected, the payment becomes failed. If the result is inconclusive, it becomes capture_pending; do not retry the capture. After the deadline passes, LydiaGate closes the payment; expired arrives after the bank confirms the release.

captureDeadline is an ISO-8601 UTC timestamp that shows the latest time you can capture the payment. The window is limited to minutes; do not hard-code a value, and read the field on every payment.

The start of the window depends on the bank connection. On some bank connections, the 3D Secure verification time is deducted from the window. On others, the window starts after 3D Secure verification. The exact limit is always the captureDeadline value in the response. On some bank connections, the field can already be populated while the payment is in authorization_pending.

A /capture call made after captureDeadline is rejected with 422 capture_window_expired. Reaching the deadline does not move the payment to expired immediately: the payment can stay in awaiting_capture until the bank confirms the release, and /capture still returns capture_window_expired. The expired status arrives after that confirmation and is reported with the payment.expired webhook. No money is taken for a payment that expires.

payment.authorized reports that the cardholder completed 3D Secure verification and that capture is waiting for your call. It does not mean that money was taken or that the amount is firmly reserved on the card. On some bank connections, no hold is placed at the bank. Treat the amount as final only when the payment is captured.

A manual payment does not always reach awaiting_capture. It can fail or expire before that stage; in that case payment.failed or payment.expired is sent.

On some bank connections, the authorization result is not final right after 3D Secure. The payment stays in authorization_pending for a short time, and no webhook is sent for this status. LydiaGate resolves the result: the payment becomes awaiting_capture (payment.authorized) or failed (payment.failed). A /capture call for a payment in this status returns 409 payment_not_capturable. Do not treat the payment as failed on your own.

POST /v1/payments/{paymentCode}/capture
Authorization: Bearer ldg_live_…

The request has no body (an empty body or {}). Response 200 OK:

{
"paymentCode": "pay_7Hq2bL",
"status": "captured",
"captureMode": "manual",
"idempotentReplay": false
}
Field Description
paymentCode The payment’s permanent identifier.
status On the first capture call: captured, failed, or capture_pending. capture_pending means the result is inconclusive; do not treat the payment as failed and do not retry the capture. On a repeated call for the same payment (idempotentReplay: true), the current status of the payment is returned; if a refund or void was made after the capture, it can also be refunded, partially_refunded, or voided. Accept these values as well.
captureMode The capture mode of the payment; always manual on this endpoint.
idempotentReplay If true, this request did not start a new capture; the current state of the payment was returned.

Repeating the call or sending it concurrently is safe: the amount is captured once. If the capture is rejected, the payment becomes failed. If a temporary hold was placed on the card, LydiaGate takes the action needed to release it. When the hold disappears from the card depends on the bank; no timing is guaranteed.

Case HTTP Code
Payment not found or not yours 404 payment_not_found
The payment is captured automatically (auto) 422 capture_mode_mismatch
The payment cannot be captured in this status: initiated, authorization_pending, expired, cancelled, a failed payment with no capture requested, or a payment whose cancellation is in progress (if the capture deadline has not passed; otherwise 422 capture_window_expired) 409 payment_not_capturable
captureDeadline has passed 422 capture_window_expired
Your account is closed 403 partner_not_active
POST /v1/payments/{paymentCode}/cancel
Authorization: Bearer ldg_live_…

The request has no body. Response 200 OK:

{
"paymentCode": "pay_7Hq2bL",
"status": "cancelled",
"idempotentReplay": false
}

Only a payment in awaiting_capture can be cancelled. On some bank connections, the cancellation is sent to the bank; until the bank confirms, the response and the payment stay awaiting_capture, and after the confirmation the payment becomes cancelled and the payment.cancelled webhook is sent. During this time the payment cannot be captured: if captureDeadline has not passed, a /capture call returns 409 payment_not_capturable; if it has passed, it returns 422 capture_window_expired. If the payment is already cancelled, the response is 200 with idempotentReplay: true.

Case HTTP Code
Payment not found or not yours 404 payment_not_found
The payment is captured automatically (auto) 422 capture_mode_mismatch
The payment is not in awaiting_capture or cancelled 409 payment_not_cancellable
Your account is closed 403 partner_not_active

In cancelled, no money was taken. cancelled is different from voided, which means a captured payment was voided. The same partnerTxCode is not released; use a new partnerTxCode for a new payment.

A payment in awaiting_capture cannot be refunded because it has not been captured yet (422 payment_not_refundable). Use /cancel if you will not capture it. For refunds of captured payments, see Refunds & Void.

Capture and cancel calls do not count against your payment creation quota.

Payments created through a payment link or from the merchant panel are always captured automatically. captureMode applies only to the POST /v1/payments request.