Embedded Refund

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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

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

MethodPOST
URLhttps://api.digetpay.com/v1/payment/s2s/refund
AuthenticationHeader 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 paymentId from the original Direct Sale response in the transactionId field (a numeric ID such as 0808983054379566192384). Do not send the UUID from the Direct Sale transactionId field, and do not use a Hosted Checkout session ID.


Request Body

ParameterTypeRequiredDescription
transactionIdstringYesThe paymentId of the original Direct Sale payment
amountnumberYesRefund 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.01 and must not exceed the remaining refundable balance.
  • After each refund, refundStatus in the S2S Transaction Status response changes:
    • NONE → No refunds processed
    • PARTIAL → One or more partial refunds processed
    • FULL → The payment has been fully refunded
📘

Example: For a payment of 100.00 SAR, you can refund 30.00 SAR first, then 20.00 SAR, and finally 50.00 SAR. After the final refund, refundStatus becomes FULL.

🚧

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"
  }
}

Response Fields

FieldDescription
resultRefund request status (accepted)
refundIdDigetPay refund reference
referenceIdRefund reference from the processor
paymentIdOriginal payment reference
amountRefund amount requested
messageResult message

result: accepted means 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 refundId with your order. Then call GET /payment/s2s/transaction/{paymentId} and mark the refund as complete in your system only after refundStatus shows PARTIAL or FULL.


Body Params
string
required

transactionId from the Status API response

number
required
≥ 0.01

Refund amount

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json