- Print
- DarkLight
The lifecycle of a payment; pre-authorisation, capturing and refunding; is managed via a single Transaction. The transaction is returned by the relevant API requests and will contain the latest state of the transaction.
As well as the current state, the transaction will also contain a history, which is a full list of all states the transaction has previously been in.
Transaction States
The possible transaction states are
AuthFailed
Authorizing
AuthSucceeded
AuthExpired
AuthVoided
Capturing
CaptureFailed
CaptureSucceeded
Refunded
Refunding
RefundFailed
The set of state transitions is outlined below:
Pre-authorization
When a transaction is pre-authorised it will either be authorised successfully and enter the AuthSucceeded
state or it will fail and be marked as AuthFailed
.
The Authorizing
state, whilst possible, is rarely seen. An Authorizing
transaction will transition to AuthSucceeded
or AuthFailed
on it's own.
Once a transaction is in the AuthSucceeded
state it can either be:
voided and moved into the
AuthVoided
statecaptured which will start the capturing process
Capturing
When capturing a transaction, if the transaction is successfully authorised and the authorization hasn't expired it will move into the Capturing
state, otherwise it will be reported as AuthFailed
or AuthExpired
depending on the scenario.
Once the payment processor has completed settling a transaction it will moved into the CaptureSucceeded
state.
A transaction will enter the Capturing
state immediately after capture is initiated, it is safe to assume a transaction will settle successfully at this point. It is exceptionally rare for payments to transition to the CaptureFailed
state. If this happens Bento will notify our partners directly.
Refunding
A transaction in the CaptureSucceeded
state can be refunded. Whilst the refund is being processed it will be in the Refunding
state and will be moved into the Refunded
state if this completes successfully otherwise it will be marked as RefundFailed
.
Failed refunds can be retried, and multiple partial refunds can be issued. The total refund amount cannot exceed the original transaction amount.
Transaction Amount
To determine the value of the transaction; how much it was authorized for, how much was captured and how much was refunded the following fields can be used:
authorizedAmount
the amount the transaction has been authorized for.capturedAmount
the amount that was captured when the transaction was captured.refundedAmout
the amount of the transaction that has been refunded.
When the capturedAmount
is non-zero, and equal to the refundedAmount
the transaction has been fully refunded.
The totalAmount
field should the aggregate of the above values. Prior to the transaction being captured it shows the authorizedAmount
. Once a transaction has been captured it shows the amount captured minus any refunds that have been issued.