| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
The Refund API allows merchants to reverse his preffered amount of a previously successful and settled transaction through the Edfapay payment gateway, returning the charged amount back to the customer’s original payment method.
This API is responsible for returning funds after the capture stage, in contrast to the VOID API, which only releases funds before capture.
Endpoint
POST https://app-api.edfapay.com/api/v1/payment-gateway/s2s/refund
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 Body
| Field | Type | Required | Description |
|---|---|---|---|
| transactionId | string | Yes | Unique transaction ID from EdfaPay. |
| amount | string | Yes | The amount to be refunded. |
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 ResponseIf the amount is set to the full transaction amount, a full refund will be processed; otherwise, a partial refund will be performed if a lower amount is provided.
Example Request
curl --location 'https://app-api.edfapay.com/api/v1/payment-gateway/s2s/refund' \
--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": "accepted",
"referenceId": "XXXXXXXXXX",
"paymentId": "XXXXXXXXXX",
"message": "Refund processed successfully",
"amount": "1",
"refundId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}{
"code": 400,
"message": "Refund amount more than sale amount",
"errorCode": "400",
"data": null
}The paymentId received for successful refund must be the same acquirerPaymentId from the original sale transaction.
Refund Rules and Guidelines
- The original transaction must be successful and captured before initiating a refund.
- The refund amount must not exceed the original transaction amount.
- Each transaction can be refunded only once (either full or partial).
Important Considerations
- Refunds must be handled carefully, as multiple failed refund attempts or technical issues may trigger the cardholder’s bank fraud detection system, potentially temporarily blocking the card.
- Ensure each refund is properly logged and tracked to prevent conflicts or duplicate refund attempts.
- Always verify that the transaction is captured before initiating a refund.
- Only one refund is allowed per transaction. Once a refund is initiated, additional refund attempts for the same transaction are not permitted.