MakeRefund

Endpoint

Overview

The "MakeRefund" endpoint is a POST request. It is used to cancel the payment and return the funds to the customer. Detailed functionality of how to use this endpoint is explained in the Refund section.

The endpoint on Swagger is: Refund_MakeRefund.

Now, we are going to declare the endpoint and its models along with each accepted parameter and possible value.

📘

Request Header

Add "Authorization": "Bearer {Token}" to request header. Token of demo configuration can be found here.

❗️

Refund Request Responsibility

Please make sure to send one refund request each time, to avoid duplicate partial refund requests (You need to handle this from your system front-end side).
Moreover, Kindly note that the refund request responsibility is on the vendor side not on MyFatoorah Side.


Request Model

The request is a POST request with the following parameters:

Input ParameterTypeDescription
KeyTypestringState either it's "InvoiceId" or "PaymentId"
KeystringValue of the key type mentioned
RefundChargeOnCustomer booleanDetermine whether the customer will be charged for the refund fees or not.
Refund fees (for the customer bank).
ServiceChargeOnCustomer booleanDetermine whether the customer will be charged for the service fees or not.
Service fees (for MyFatoorah).
Amount decimalThe amount to be refunded
Comment stringExtra comments for your reference
AmountDeductedFromSuppliernumber, optionalThis is the amount that will be deducted from the supplier in the refund process. It will be part form the total amount.

For example: If the total amount is 100 and the AmountDeductedFromSupplier is 70, the vendor will pay the 30 and the supplier will pay 70

❗️

Currency Parameter

In the request, the currency parameter has been omitted, as the value passed for the refund would represent the account default currency based on the token you are using. So, please get sure of the amount and used token as they determine the exact amount to be refunded.


Response Model

After viewing the Response Model that you will get as a result of your request, here, you will find full details about the Data Model of this API endpoint. Let's check it and its contents.

Response FieldTypeDescription
KeystringThe key value you have passed for the Request Transaction
RefundIdnumber
RefundReferencestringThe refund reference generated by MyFatoorah for following up with the finance team
RefundInvoiceIdstringThe InvoiceId of the refunded amount
AmountnumberThe amount to be refunded
CommentstringThe comments that you have passed in the request

Sample Message

{
  "Key": "3445302",
  "KeyType": "invoiceid",
  "RefundChargeOnCustomer": false,
  "ServiceChargeOnCustomer": false,
  "Amount": 1,
  "Comment": "partial refund to the customer",
  "AmountDeductedFromSupplier": 0,
  "CurrencyIso": "KWD"
}
{
  "IsSuccess": true,
  "Message": "Refund Created Successfully!",
  "ValidationErrors": null,
  "Data": {
    "Key": "3445302",
    "RefundId": 86815,
    "RefundReference": "2024000022",
    "RefundInvoiceId": 3449413,
    "Amount": 1,
    "Comment": "partial refund to the customer"
  }
}