Refunds
Refund a completed payment, in full or in part.
A refund sends money back from the account that received a payment to the account that paid it. You create the refund with one API call. The holder of the account that received the payment then approves the refund at their bank, through a payUrl link.
At a glance
| Question | Answer |
|---|---|
| Which payments can be refunded? | Payments with status ACCC, ACSC, ACSP, ACTC, ACWC or ACFC. A refund cannot be refunded |
| Partial refunds? | Yes. You can create several refunds, up to the original amount in total |
| What is a refund? | A new payment, with isRefund: true and originalPaymentId set to the original payment |
| Who approves it? | The holder of the account that received the original payment, through payUrl |
| Which scope? | create:refund |
1. Create a refund
POST https://api.open-finance.ai/v2/payments/{paymentId}/refund, with a bearer token that has the create:refund scope. If your token does not have it, contact support.
paymentId is the ID of the original payment. It can be any payment of your organization.
{
"amount": 50,
"description": "Refund for order 1234",
"psuId": "000000018",
"sendSMS": true,
"phoneNumber": "0500000000"
}Request fields
| Key | Type | Description | Required |
|---|---|---|---|
amount | number | The amount to refund. At most the original amount minus the amount already refunded | Yes |
description | string | Description of the refund | Yes |
psuId | string | National ID of the holder of the account that pays the refund (the account that received the original payment) | See note |
psuCorporateId | string | Business ID of that account holder | No |
sendSMS | boolean | Send payUrl to the account holder by SMS | No |
phoneNumber | string | Phone number for the SMS | No |
Merchant defaultsWhen the original payment was made to a merchant (
merchantId), the merchant's saved ID number, business ID and phone number are used for any ofpsuId,psuCorporateIdandphoneNumberyou leave out. Without a merchant,psuIdis required.
A successful response is HTTP 201:
{
"id": "example-refund-id",
"payUrl": "https://.../su/example-short-id",
"sentMerchantSMS": true
}| Key | Description |
|---|---|
id | The payment ID of the refund. The refund is a new payment |
payUrl | The link where the account holder approves the refund. Valid for 24 hours |
sentMerchantSMS | true when the SMS was sent |
The refund amount is added to the original payment's refundedAmount right away, before the refund is approved.
How the refund is saved as a payment
The refund is created as a new payment with status INIT:
debtorAccountNumberis the account that received the original payment, and the refund is set to that account's bank.creditorAccountNumberis the account the original payment was paid from.isRefundistrueandoriginalPaymentIdis the original payment's ID.
2. The account holder approves it
Send payUrl to the account holder. The journey shows the refund, and the account holder approves it at their bank.
When sendSMS is true, an SMS in Hebrew with the amount and payUrl is sent to phoneNumber, or to the merchant's phone number. If there is no phone number, or sending fails, the refund is still created and sentMerchantSMS is false.
3. Follow the refund
The refund moves through the usual payment statuses.
- Webhooks: status changes of the refund are sent to your organization's webhook from the Dashboard, not to the original payment's
callbackInformation. - Reading the refund: use
GET /v2/payments/{id}with a token for the same user that created the refund.
Error responses
| Status | Error | Description |
|---|---|---|
| 400 | Payment not found | No payment with this ID in your organization |
| 400 | Cant refund a refund payment | The payment is itself a refund |
| 400 | Can't refund uncompleted payments | The payment's status is not one of the refundable statuses |
| 400 | Maximum left to refund for this payment: ... | amount is more than what is left to refund |
| 400 | Psu id must be in request or in merchant details | No psuId was sent, and there is no merchant ID number to use |
| 403 | — | The token does not have the create:refund scope |
Next steps
Updated about 3 hours ago
