| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Refund a previously successful payment (full or partial) using the gateway transaction ID.
Recommended usage: Refunds are processed against the original gateway transaction. Partial refunds are supported until the remaining refundable balance reaches zero.
Endpoint
| Method | POST |
| URL | {baseUrl}/payment/refund |
| Authentication | Header x-api-key |
Fin Staging Base URL
https://fin-api.digetpay.com/v1Important: The
transactionIdmust be the gateway transaction ID (UUID).Do not use the checkout session ID or the numeric
paymentId.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | Gateway transaction UUID |
amount | number | Yes | Refund amount (minimum 0.01) |
Example Request
{
"transactionId": "2232e99b-0257-47d5-bbfd-022c8951767f",
"amount": 0.20
}Important: The refund amount must not exceed the remaining refundable balance. Otherwise the API returns:
Refund amount more than sale amount
Refund Flow
sequenceDiagram
autonumber
participant Merchant as Your Server
participant API as DigetPay API
participant Gateway as Payment Gateway
Merchant->>API: POST /payment/refund
API->>Gateway: Process refund
Gateway-->>API: Refund accepted
API-->>Merchant: result, refundId
Note over Merchant,API: Verify refundStatus using Query Transaction Status
Partial refunds
DigetPay supports both full and partial refunds.
- A transaction can be refunded in multiple partial refunds until the original payment amount is fully refunded.
- Each refund amount must be greater than
0.01and must not exceed the remaining refundable balance. - After each successful refund, the
refundStatusreturned by the Query Transaction Status API changes accordingly:NONE→ No refunds processedPARTIAL→ One or more partial refunds processedFULL→ The payment has been fully refunded
Example: For a payment of 100.00 SAR, you can refund
30.00 SARfirst, then20.00 SAR, and finally50.00 SAR. After the final refund, the transaction'srefundStatusbecomesFULL.
Responses
{
"success": {
"status": 200,
"body": {
"code": 200,
"message": "Success",
"errorCode": null,
"data": {
"result": "accepted",
"referenceId": "2026001124",
"paymentId": "0808779145497567115585",
"message": "Refund Created Successfully!",
"amount": "0.20",
"refundId": "1046772"
}
}
}
}{
"failed": {
"status": 400,
"body": {
"code": 400,
"message": "Refund amount more than sale amount",
"errorCode": "400",
"data": null
}
}
}{
"failed_unauthorized": {
"status": 401,
"body": {
"statusCode": 401,
"message": "Missing API key",
"error": "Unauthorized"
}
}
}Response Fields
| Field | Description |
|---|---|
result | Refund request status (accepted) |
refundId | DigetPay refund reference |
paymentId | Original payment reference |
amount | Refunded amount |
Best practice: After submitting a refund, call Query Transaction Status and verify that
refundStatuschanges to PARTIAL or FULL.
result: acceptedmeans the refund request has been successfully submitted. Final settlement may complete asynchronously depending on the card scheme.
