Refund Request

A refund is a transaction process where a merchant returns funds to a customer after a payment has been processed

API Reference

Refund Implementation Steps

Create a Refund Request

To create a refund request for a transaction, pass the following parameters

Sandbox Refund Request API

Below Refund API strictly for sandbox testing only. Never use these sandbox URL's in production environment

https://merchantapisandbox.hesabe.com/api/refund

Production Refund Request API

Use the following Refund API strictly for production transactions. Ensure that you never use these production URLs in the sandbox or testing environment

https://merchantapi.hesabe.com/api/refund
RefundRequest.php
$baseUrl = 'http://merchantapisandbox.hesabe.com/api/'; // sandbox
$refundRequestApiUrl = $baseUrl . 'refund';  
$data = [
    'merchantCode' => '842217', // Sandbox Merchant Code
    'token' => '521042117249344539468767555844', // Transaction Token Number
    'refundAmount' => 1.000, // Refund Amount
    'refundMethod' => 2, // 1 for Full Refund, 2 for Partial Refund
];
$checkoutRequest = Request::create($refundRequestApiUrl, 'POST', $data);
$checkoutRequest->headers->set('accessCode', $accessCode);

Here's an refund request parameters details

FieldDescriptionRequired
merchantCode
Merchant Code is a unique identifier generated by Hesabe for each activated merchantYes
token
Transaction Token of the original transactionYes
refundAmount
Amount to be refundedYes
refundMethod
1 for Full Refund / 2 for Partial RefundYes

Refund Response Details

Here's an sample refund response structure

{
    "status": true,
    "message": "Your refund request is waiting for approval", 
    "data": {
        "token": "521042117249344539468767555844", 
        "amount": "1.000",
        "order_reference_number": "1724934434",
        "transaction_status": "SUCCESSFUL",
        "refund_status": "PENDING",  
        "payment_type": "KNET",
        "service_type": "Payment Gateway",
        "transaction_datetime": "2024-08-29 15:27:38",
        "refund_requested_at": "2024-09-04 15:04:44"
    }
}