refund Refund

The following endpoint is used to return the funds back to the client. The payment will be returned to the credit or debit card that was originally charged.

If the refund request date is before midnight and isn't settled yet, the bank will return the money to a client directly.

If the refund request date is after midnight according to Greenwich Mean Time or is settled, Fatora will send the request to the bank, and the bank will return the money back to the client within 2-4 weeks.

Refund API

https://api.fatora.io/v1/payments/refund
curl -X POST 'https://api.fatora.io/api/v1/payments/refund' \
-H 'Content-Type: application/json' \
-H 'api_key:  E4B73FEE-F492-4607-A38D-852B0EBC91C9' \
--data-raw '{
    "transaction_id" : "123456789",
    "order_id" : "123456789"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fatora.io/api/v1/payments/refund',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'api_key:  E4B73FEE-F492-4607-A38D-852B0EBC91C9'
  ),
  CURLOPT_POSTFIELDS =>'{
    "transaction_id" : "123456789",
    "order_id" : "123456789"
}'
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.fatora.io/api/v1/payments/refund"))
    {
        request.Headers.Add("api_key", "E4B73FEE-F492-4607-A38D-852B0EBC91C9");
        request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");

        RefundPayment refundPayment = new RefundPayment(){
        {
            transaction_id = "123456789",
            order_id = "123456"
        };

        string payload = JsonConvert.SerializeObject(payment);
        request.Content = new StringContent(payload);
        var response = httpClient.SendAsync(request);
    }
}
{
status : "SUCCESS",
 result : {
    refund_status : "completed"|"under_proccession",
    mode : "live|test",
    refund_transaction_id : XXXXXX
    }
}

Try it now: Refund API

Header Parameters

Header Value
api_key REQUIRED Use the valid API key of your Fatora account. Read more information about Authentication.
Content-Type REQUIRED application/json

Request Parameters

Parameter Description
transaction_id REQUIRED stringThe transaction id of payment issued from bank.
order_id REQUIRED stringA unique identifier for order in your application

Response

The successful request returns the HTTP 200 OK status code and a JSON response body that shows the refund request details.

Response Schema: application/json
status string the status of response.
SUCCESS
result arrayThe result array contines the following values:
objectThe result contains the following values:
  • refund_status enum value [completed, under_proccession].
  • mode enum value [live, test].
  • refund_transaction_id The transaction id returned from bank of refunded payments

Otherwise if there was a problem with your request, you'll receive an error response such as 400 status code, and the response will include an error object describing why this request failed.

Response Schema: application/json
status string The status of response.
error object:
  • error_code string, the naumber of error: e.g: 400, For more information
    see Response Code
  • description string, the description of error: e.g: bad request
technical-support

🛠️ Technical Support