Payment authorizations
The payment authorization object and the allowed CRUD operations on the related resource endpoint
A payment authorization is the first transaction in a payment session's lifecycle. The transaction is processed asynchronously — on success, it reserves the session amount on the customer's payment instrument without collecting funds, transitioning the payment session to authorized status.
Fetching a payment authorization returns all information and messages provided by the payment setting. To collect or cancel the reserved funds, create a payment capture or payment void referencing this authorization.
Authorization amount
The authorization amount always matches the payment session amount exactly. You cannot authorize a partial amount — if you need to collect a different amount, adjust it at the session level before authorizing.
Retrying a failed attempt
The gateway's confirmation can fail before ever reaching succeeded — for example, a customer failing a 3DS challenge. A pre-success failure doesn't touch the session itself, so you can create a new payment authorization for the same session to retry, without needing to start over with a new session. Retrying on the same session also requires that the session not have expired.
Capture and void balances
A payment authorization tracks two balance attributes:
capture_balance_cents— the amount still available for capture (session amount minus already captured amounts).void_balance_cents— the amount still available to void (zero once the authorization has been voided).
Event-driven creation
Gateway webhook events can create a payment authorization automatically if one does not already exist for the session. 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.
When the session already has an authorization, the incoming event updates that one rather than adding a second. The session's current authorization is the succeeded one if any exists, or otherwise the most recent attempt.
Invalidation
An authorization can end up invalidated two different ways, both outside your control:
Gateway reversal — A gateway occasionally reverses its own earlier success, for example an issuer approving a payment and then declining it minutes later once risk or fraud checks complete. When this happens, Commerce Layer moves the authorization from
succeededto whichever negative status the gateway's event maps to —declined,failed,canceled, orexpired— and marks the payment session asinvalidated, since the funds it reported as reserved never actually were.Gift card failure — The authorization attempt fails outright, without ever reaching
succeeded, because the gift card can no longer be resolved or its balance is insufficient by the time authorization runs (more details here).
Handling 3DS and customer action
For gateways whose SCA/3DS challenge requires multiple steps, the authorization may transition to requires_action instead of proceeding directly to succeeded. In that case, next_action_type and next_action_data are populated to tell the client what to do next:
next_action_type— the kind of action required from the customer. One ofredirect,challenge,fingerprint, orpresent.next_action_data— the gateway-specific data needed to perform that action (e.g. the redirect URL, the challenge or fingerprinting payload, etc.).
Both attributes are null once the authorization leaves requires_action. How the flow resumes depends on the gateway:
Client-side submission — after the customer completes the challenge, the client must update the authorization and pass the
_payment_detailstrigger attribute to submit the result and drive the transaction to its final state.Event-driven — the authorization status is updated automatically when the payment provider fires the corresponding webhook event. No additional API call is needed.
Last updated