In-Direct Payment Method
Customers are redirected to Hesabe's secure payment gateway landing page where they can select their preferred payment method. This method offers quick implementation with automatic security handling.
Hesabe In-Direct Payment Integration
Through the Hesabe Payment interface, merchants can enable payment options such as KNET, Visa/MasterCard, American Express, Apple Pay, and Google Pay, while retaining complete control over the entire payment flow.
| ✨ Features | In-Direct Integration |
|---|---|
| Quick and easy implementation | ✅ |
| Hesabe-hosted secure payment page | ✅ |
| Automatic security handling | ✅ |
| PCI DSS compliance built-in | ✅ |
✍🏻 Create payment request with parameters
Collect the order details and ensure the paymentType parameter is included (value: 0)
Good to know
PaymentType "0" indicates an Indirect Payment
🌐 Send payment request to Hesabe API
Initiate a transaction by sending the order and payment details to the Hesabe Checkout API.
Use our sandbox environment to test the integration flow, validate parameters, and simulate real payment scenarios before moving to production.
🔄 Redirect customer to Hesabe payment page
Redirect customers to Hesabe Payment Landing Page and customer will select the payment method to process the order

✅ Handle success/failure scenarios
After transaction redirect customers to the appropriate success or failure pages.
📋 Request Parameters
| 🏷️ Field | 📋 Type | 📝 Description | Required |
|---|---|---|---|
merchantCode | String | Assigned by Hesabe | Yes |
amount | Numeric | Amount in currency | Yes |
paymentType | Numeric | 0 - Indicates Indirect Payment | Yes |
currency | String | ISO currency code | Yes |
responseUrl | String | Redirect URL on success | Yes |
failureUrl | String | Redirect URL on failure | Yes |
version | String | 2.0 | Yes |
orderReferenceNumber | String | Your reference / order ID | Yes |
Additional Checkout API Parameters
Optional parameters that allow you to include extra data or customize the checkout flow in your API request
| Field | Type | Description | Required |
|---|---|---|---|
name | String | Customer Name | Optional |
mobile_number | Numeric (8) | Customer Mobile Number ( Without country code ) | Optional |
email | String | Customer Email Address | Optional |
webhookUrl | String | Your endpoint for receiving payment status | Optional |
variable1 | Alphanumeric | Custom user parameter which will be included in the response when it returns | Optional |
variable2 | Alphanumeric | Custom user parameter which will be included in the response when it returns | Optional |
variable3 | Alphanumeric | Custom user parameter which will be included in the response when it returns | Optional |
variable4 | Alphanumeric | Custom user parameter which will be included in the response when it returns | Optional |
variable5 | Alphanumeric | Custom user parameter which will be included in the response when it returns | Optional |
Read more about Hesabe Webhook URL
You can follow the Hesabe Webhook Request guide to get started.
⚙️ Hesabe Request Handler
The following PHP Laravel code snippets demonstrate how the payment request process can be implemented.
Request Validation
First, validate the incoming payment request data to ensure all required fields are present and properly formatted.
Important Note
Payment data containing the required fields in encrypted form must be submitted to the 'Checkout' endpoint for initiating the payment request.
$validator = $this->validate($request, [
'merchantCode' => 'required',
'amount' => 'required|numeric|between:0.200,100000|regex:/^\d+(\.\d{1,3})?$/',
'paymentType' => 'required|in:0,1,2,5,7,8,9,10,11,12,13,14,16', // '0' For indirect method only
'responseUrl' => 'required|url',
'failureUrl' => 'required|url',
'version' => 'required',
'webhookUrl' => 'https://yourdomain.com/example' // [Optional Field] To get transaction response
]);Read more about Hesabe Webhook URL
You can follow the Hesabe Webhook Request guide to get started.
Configuration Setup
Loading Encryption Keys, Access Code & API URL's from config
$ivKey = HSB_IV_KEY;
$encryptionKey = HSB_ENCRYPTION_KEY;
$accessCode = HSB_ACCESS_CODE;
$checkoutApiUrl = HSB_CHECKOUT_API_URL;
$paymentUrl = HSB_PAYMENT_URL;JSON Encoding
After validation, convert the request data to JSON format containing all the request keys and values.
$requestDataJson = json_encode($request->input());Data Encryption
Encrypt the JSON data using AES algorithm with the HesabeCrypt library for secure transmission.
$encryptedData = HesabeCrypt::encrypt($requestDataJson, $encryptionKey, $ivKey);API Request to Checkout Endpoint
Send the encrypted data to Hesabe's checkout API with proper headers including the access code.
Sandbox Checkout API
Below Checkout API strictly for sandbox testing only. Never use these sandbox URL's in production environment
Production Checkout API
Use the following Checkout API strictly for production transactions. Ensure that you never use these production URLs in the sandbox or testing environment
$baseUrl = "https://sandbox.hesabe.com";
$checkoutApiUrl = $baseUrl . "/checkout";
$checkoutRequestData = new Request([ 'data' => $encryptedData ]);
$checkoutRequest = Request::create($checkoutApiUrl, 'POST', $checkoutRequestData->all());
$checkoutRequest->headers->set('accessCode', $accessCode);
$checkoutRequest->headers->set('Accept', 'application/json'); // Only for JSON responseResponse Handling
Process the API response and extract the content for further processing.
$checkoutResponse = Route::dispatch($checkoutRequest);
$checkoutResponseContent = $checkoutResponse->content();Response Decryption
Decrypt the response using the same encryption keys and parse the JSON data.
$decryptedResponse = HesabeCrypto::decrypt($checkoutResponseContent, $encryptionKey, $ivKey);
$responseDataJson = json_decode($decryptedResponse);Payment Page Redirection
Extract the payment token from the response and redirect to Hesabe's payment URL.
Sandbox Payment API
Below payment API strictly for sandbox testing only. Never use these sandbox URL's in production environment
Production Payment API
Use the following payment API strictly for production transactions. Ensure that you never use these production URLs in the sandbox or testing environment
$paymentUrl = {{baseUrl}}/payment
$responseToken = $responseDataJson->response->data;
return Redirect::to($paymentUrl . '?data='. $responseToken);Sample Transaction Response Structure
Here's an example of a successful payment response after decryption:
{
"status": true,
"code": 1,
"message": "Transaction Success",
"response": {
"data": {
"resultCode": "CAPTURED",
"amount": 10,
"paymentToken": "1569830677725743478",
"paymentId": "100201927384634224",
"paidOn": "2019-09-30 11:05:16",
"orderReferenceNumber": null,
"variable1": null,
"variable2": null,
"variable3": null,
"variable4": null,
"variable5": null,
"method": 1
}
}
}Transaction Response Parameters Reference
Here's an transaction response parameters details
| Field | Type | Description |
|---|---|---|
status | Boolean | Payment status (true for success; false for failure) |
resultCode | String | Success transactions have values "CAPTURED", "ACCEPT", or "SUCCESS" |
amount | Numeric | Transaction Amount |
paymentToken | Numeric | 14-digit Payment Token returned from Hesabe |
paymentId | Alphanumeric | Payment ID returned from Hesabe |
paidOn | Alphanumeric | Date and Time of Payment |
orderReferenceNumber | Alphanumeric | Payment ID returned from Hesabe |
variable1 | Alphanumeric | Custom user parameter which will be included in the response when it returns |
variable2 | Alphanumeric | Custom user parameter which will be included in the response when it returns |
variable3 | Alphanumeric | Custom user parameter which will be included in the response when it returns |
variable4 | Alphanumeric | Custom user parameter which will be included in the response when it returns |
variable5 | Alphanumeric | Custom user parameter which will be included in the response when it returns |
method | Numeric | Transaction Payment method ID |
For Any Technical Assistance
If you encounter any issues or need support during setup or integration, please contact our technical team for assistance.
Hesabe IT Support
Direct Payment Method
This comprehensive guide will help you integrate your application or platform with Hesabe's Payment Gateway API, supporting multiple integration methods and advanced features.
Direct Apple Pay
This comprehensive guide will help you integrate your application or platform with Hesabe's Payment Gateway API, supporting multiple integration methods and advanced features.