Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Beta

Payment captures

The payment capture object and the allowed CRUD operations on the related resource endpoint

A payment capture collects funds that were previously reserved by a payment authorization. The transaction is processed asynchronously — on success, the payment session transitions to paid (full capture) or partially_paid (partial capture), and the capture balance on the authorization is decremented accordingly.

A session that was partially refunded can still capture the rest of its authorization. In that case the session stays partially_refunded after the capture succeeds, since part of the captured amount has already been given back. The order's payment status is still refreshed as usual.

Fetching a payment capture returns all the information and messages provided by the payment setting. A capture can be partially or fully refunded after it succeeds.

Capture amount

The amount_cents is optional and defaults to the full remaining capture_balance_cents on the associated authorization. A single capture cannot exceed the authorization amount. Partial captures are supported — multiple captures can be made against the same authorization until the capture_balance_cents reaches zero.

A capture must reference a payment authorization at creation time. Only authorizations belonging to the same payment session are accepted.

Event-driven creation

Gateway webhook events can create a payment capture automatically if one does not already exist for the authorization. This means a transaction does not need to be explicitly created via the API first — Commerce Layer will create it in response to the event, ensuring the session status and order payment status are always kept in sync regardless of whether the flow was API-initiated or event-driven.

Incoming events are matched to an existing capture by the gateway's own reference for that operation. A reference already seen updates the capture it belongs to, while a reference not seen before creates a new one.

Gateways don't guarantee delivery order and may send the same event more than once. An event arriving for a capture that has already reached a final status is ignored, so a redelivery can't overwrite a settled outcome or inflate the amount an order counts as captured — receiving the same capture notification twice still only records the capture once.

If a capture event arrives and the corresponding payment authorization is missing, behavior depends on the gateway:

  • Adyen — the missing authorization is synthesized from the event itself, reusing the originalReference Adyen supplies, so the capture can still be created and the session kept in sync.

  • Braintree — capture events do not cascade. A capture is only created if a succeeded payment authorization already exists for the session. Otherwise, the event is silently dropped.

  • Checkout.com — the missing authorization is synthesized, reusing the event's real payment ID — stable across the whole payment lifecycle — as an accurate token. The amount, though, is still approximated, reusing the capture's own amount instead of the full original authorization amount.

  • PayPal — the missing authorization is synthesized, but the PAYMENT.CAPTURE.COMPLETED event carries no separate authorization reference, so it reuses the capture event's own resource ID and amount as an approximation.

  • Stripe — the missing authorization is synthesized from the event itself, reusing the real charge ID and its actual authorized amount, so the capture can still be created and the session kept in sync.

  • External (custom gateways) — the webhook payload must explicitly include the reference_transaction_token for the authorization. If it's missing, the event is rejected with a 422 Unprocessable Entity response.

Auto-capture

If the related payment setting has auto_capture enabled, a capture is created automatically upon a successful authorization, recorded as already succeeded and bypassing the payment gateway interaction. The auto flag in the response data indicates the capture was triggered automatically.

Refund balance

A capture tracks a refund_balance_cents attribute representing the amount still available to refund (capture amount minus already refunded amounts).

Last updated