- Capturing authorized funds
- Refunding captured payments
- Voiding pending or authorized payments
- Reading failed operations (HTTP
402) - Why card validations (amount
0) can’t be captured, voided or refunded - Handling a refund whose outcome is not yet known (
PENDING)
Captures
Capture a payment by submitting aPOST request to /v1/payments/{paymentId}/capture.
The paymentId received in the response to payment creation is passed as a path parameter.
Partial captures are not yet supported. No body should be sent in the request. If
captureAmount is sent, it is ignored and the full amount is captured.Refunds
Refund a payment by submitting aPOST request to /v1/payments/{paymentId}/refund.
The paymentId received in the response to payment creation is passed as a path parameter.
If you wish to make a partial refund, the refundAmount should be passed in the request body. You can make several partial refunds, as long as their total doesn’t exceed the captured amount. Full refunds are available at any time.
Partial refunds work in production only. The sandbox ignores
refundAmount and refunds the full amount (see Testing).402 with status: FAILED and a failureCode. Here status describes the refund attempt, not the payment; see Failed operations. Two codes are specific to refunds:
In both cases no refund was issued and the payment itself keeps its previous status, so a later retry cannot refund twice.
If the refund outcome is not yet known
Occasionally the payment provider doesn’t confirm whether a refund went through. In that case the refund request returns HTTP200 with status: PENDING.
Here status describes the refund, not the payment: the payment stays CAPTURED while the refund is pending. Payments never move back to PENDING.
Don’t send the refund again. We check the outcome with the provider automatically:
A payment that is still
CAPTURED with no PAYMENT_REFUNDED webhook means the refund isn’t confirmed yet, not that it failed.
While a refund is pending, another refund request on the same payment returns HTTP 409 with status: FAILED and failure code REFUND_IN_PROGRESS. A new refund is accepted once the pending one is resolved. If refunds on the payment are still blocked after 24 hours, contact support.
Voids
Void a payment by submitting aPOST request to /v1/payments/{paymentId}/void.
The paymentId received in the response to payment creation is passed as a path parameter.
You can void a payment that is AUTHORIZED or PENDING, except a card validation:
- On an
AUTHORIZEDpayment, the void releases the authorization. - On a
PENDINGpayment, the void cancels any scheduled attempts. Void aPENDINGpayment whenever no further attempts should be made (see Recover payments).
VOIDED and we send a PAYMENT_VOIDED webhook. Voiding a payment in any other status returns HTTP 422 with VOID_NOT_ALLOWED.
If a retry is in progress
If a retry attempt is already in progress when you send the void, the void fails. What to do next depends on what follows:Card validations
A card validation (a payment created withamount: 0) can’t be captured, voided or refunded: nothing was charged or held. Each of these requests returns HTTP 400 with failure code INVALID_REQUEST:
status: FAILED describes the capture, void or refund you requested, not the payment. The payment stays AUTHORIZED. To charge the card, create a new payment with the amount to charge.
Failed operations
When a payment creation, capture, refund or void fails, the API returns HTTP402 with status: FAILED and a failure object.
In a 402 response, status is the result of the operation you just requested, not always the status of the payment:
amount also describes the attempt: for a partial refund it is the refund amount you requested, not the payment amount. On a full refund, where you send no refundAmount, the field is absent from the response.
A successful request works differently: the 200 response returns the payment, so status is the payment’s new status (CAPTURED, REFUNDED or VOIDED). The one exception is a refund whose outcome is not yet known: it returns 200 with status: PENDING, which describes the refund while the payment stays CAPTURED (see If the refund outcome is not yet known).
After a failed capture, refund or void, don’t treat the payment as failed. To read its current status, query the payment as shown below.
Query
Get payment details including the payment status by submitting aGET request to /v1/payments/{paymentId}.
The paymentId received in the response to payment creation is passed as a path parameter.
Payments can’t be looked up by merchantReference. If a create request times out, wait for the PAYMENT_CREATED webhook to get the paymentId (see Timeouts and retries).