Refunds an Embedded (S2S) payment, in full or in part. Send the trans_id from the Direct Sale response in transactionId. result: accepted is not final; check refundStatus with Embedded Transaction Status.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Refund a previously successful Embedded (S2S) payment, in full or in part.
Recommended usage: Refunds are processed against the original payment. Partial refunds are supported until the remaining refundable balance reaches zero.
Endpoint
| Method | POST |
| URL | https://api.digetpay.com/v1/payment/s2s/refund |
| Authentication | Header x-api-key (Test API Key or Live API Key) |
The same URL is used in Test Mode and Live Mode. Use the API key of the same mode that created the original payment.
Important: Send the
paymentIdfrom the original Direct Sale response in thetransactionIdfield (a numeric ID such as0808983054379566192384). Do not send the UUID from the Direct SaletransactionIdfield, and do not use a Hosted Checkout session ID.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | The paymentId of the original Direct Sale payment |
amount | number | Yes | Refund amount, at least 0.01 |
Example Request
{
"transactionId": "0808983054379566192384",
"amount": 0.11
}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/s2s/refund
API->>Gateway: Process refund
Gateway-->>API: Refund accepted
API-->>Merchant: result: accepted, refundId
Note over Merchant,API: Refund is not final yet
Merchant->>API: GET /payment/s2s/transaction/{paymentId}
API-->>Merchant: refundStatus: PARTIAL / FULL
Partial refunds
DigetPay supports both full and partial refunds.
- A payment can be refunded in several partial refunds until the original amount is fully refunded.
- Each refund amount must be at least
0.01and must not exceed the remaining refundable balance. - After each refund,
refundStatusin the S2S Transaction Status response changes: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,refundStatusbecomesFULL.
Do not resend a pending refund. Wait until the previous refund is confirmed before sending another refund for the same payment. If a request times out, check the refund status before retrying, so the customer is not refunded twice.
Responses
{
"code": 200,
"message": "Success",
"errorCode": null,
"data": {
"result": "accepted",
"referenceId": "2026001124",
"paymentId": "0808779145497567115585",
"message": "Refund Created Successfully!",
"amount": "0.20",
"refundId": "1046772"
}
}{
"code": 400,
"message": "Refund amount more than sale amount",
"errorCode": "400",
"data": null
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing API key",
"path": "/v1/payment/s2s/refund",
"timestamp": "2026-10-21T08:03:53.456Z"
}Response Fields
| Field | Description |
|---|---|
result | Refund request status (accepted) |
refundId | DigetPay refund reference |
referenceId | Refund reference from the processor |
paymentId | Original payment reference |
amount | Refund amount requested |
message | Result message |
result: acceptedmeans the refund request was accepted. It does not mean the refund is complete. The refund completes asynchronously, and the time for the money to reach the customer's card depends on the card issuer.
Best practice: Store
refundIdwith your order. Then callGET /payment/s2s/transaction/{paymentId}and mark the refund as complete in your system only afterrefundStatusshows PARTIAL or FULL.

