| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
The Capture API is used in a two-step payment flow where the merchant first authorizes an amount and later captures it. This flow is common in industries where the final amount may not be known at the time of authorization, such as hospitality, delivery services, or bookings.
To use this flow, you must first perform a SALE transaction with the auth=Y parameter enabled, which only authorizes the amount but does not capture it.
Once the authorization is successful, you can then finalize the payment using the CAPTURE action by providing the original transaction ID and the amount you wish to capture.
Endpoint
POST https://app-api.edfapay.com/api/v1/payment-gateway/s2s/capture
Content-Type: application/json
Authentication
All requests to this endpoint must include a valid X-API-KEY in the request header for authentication. The X-API-KEY must be sent from the server side and should not be exposed on the client side.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| transactionId | string | Yes | Unique transaction ID from EdfaPay. |
| amount | string | Yes | Amount to capture (must be ≤ authorized amount) |
Important NoteYou can get the transactionId from
- Dashboard in the transaction page with name Transaction ID.
- Webhook(callback) response with value of parameter
transactionIdalso in the Successful Response
Example cURL Request
curl --location 'https://app-api.edfapay.com/api/v1/payment-gateway/s2s/capture' \
--header 'accept: */*' \
--header 'X-API-KEY: <Your API Key>' \
--header 'Content-Type: application/json' \
--data '{
"transactionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"amount": 1
}'Response Example
{
"code": 200,
"message": "Success",
"errorCode": null,
"data": {
"result": "SUCCESS",
"action": "CAPTURE",
"rrn": "XXXXXXXXXX",
"order_id": "XXXXXXXXXX",
"trans_id": "XXXXXXXXXXXXXXXXXXXX",
"card_brand": "MASTER",
"merchant_name": "Your Name",
"decline_reason": null
}
}{
"code": 400,
"message": "[400] during [POST] to [http://payment-gateway/payment-gateway/s2s/payment/capture][PaymentGatewayClient#postS2SCapture(AuthorizedTransactionRequest)]: [{\"code\":400,\"message\":\"There's already voided or captured for the auth transaction\",\"errorCode\":\"400\",\"data\":null}]",
"errorCode": "400",
"data": null
}
Notes
- The CAPTURE action only works for transactions that were authorized with
auth=Yduring the SALE request.- You must capture within the validity period set by the acquiring bank; otherwise, the authorization may expire.
- Make sure the amount in the CAPTURE request is less than or equal to the original authorized amount.
- The
transactionIdused in the capture request must be valid, from a successful authorized SALE, and not already captured.