Webhook Integration
Implement a webhook to receive real-time transaction updates by creating a POST API endpoint designed to accept transaction parameters. Include your URL in the "webhookUrl" variable along with other required parameters as specified in the Hesabe developer portal.
📋 Webhook Implementation Steps
Payment Checkout Integration Steps
Refer Hesabe Checkout API Guides before integrating webhook steps
Info
You can follow the Hesabe Request Handler guide to get started.
Add Webhook URL in Checkout API
Include your URL in the "webhookUrl" variable when initiating payment requests
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 = "http://sandbox.hesebe.com/api/";
$CheckoutApiUrl = "{$baseUrl}/checkout";
$requestData = [
"merchantCode" => "842217",
"amount" => "2",
"paymentType" => "9",
"responseUrl" => "https://sandbox.hesabe.com/customer-response?id=842217",
"failureUrl" => "https://sandbox.hesabe.com/customer-response?id=842217",
"version" => "2.0",
"orderReferenceNumber" => "9874659805",
"currency" => "KWD",
"name" => "customername",
"email" => "customeremail@gmail.com",
"mobile_number" => "66666666",
"variable1" => "First__variable",
"variable2" => "Second__variable",
"variable3" => "Third__variable",
"variable4" => "forth__variable",
"variable5" => "example.com",
"webhookUrl" => 'https://yourdomain.com/example' // Add your Webhook URL
]; Process Webhook Data
Handle incoming webhook data to update your system with transaction status
{
"blocks":[
{
"type":"header",
"text":{
"type":"plain_text",
"text":"TRANSACTION SUCCESSFUL",
"emoji":true
}
},
{
"type":"section",
"fields":[
{
"type":"mrkdwn",
"text":"*Date & Time:*\n2023-09-20T10:09:36"
},
{
"type":"mrkdwn",
"text":"*Transaction Token:*\n84221716951937729753667644493"
}
]
},
{
"type":"section",
"fields":[
{
"type":"mrkdwn",
"text":"*Order Reference Number:*\n1695193758"
},
{
"type":"mrkdwn",
"text":"*Service Type:*\nPayment Gateway"
}
]
},
{
"type":"section",
"fields":[
{
"type":"mrkdwn",
"text":"*Amount:*\nKWD 49"
},
{
"type":"mrkdwn",
"text":"*Payment Type:*\nKNET"
}
]
}
],
"token":"84221716951937729753667644493",
"amount":"49.000",
"reference_number":"1695193758",
"status":"SUCCESSFUL",
"payment_type":"KNET",
"service_type":"Payment Gateway",
"datetime":"2023-09-20 10:09:36"
}Key Response Fields
Here's an transaction response parameters details
| Field | Description | Example Value |
|---|---|---|
token | Unique transaction identifier returned by Hesabe | 84221716951937729753667644493 |
amount | Transaction amount with decimal precision | 49.000 |
reference_number | Merchant's order reference number | 1695193758 |
status | Transaction status (SUCCESSFUL, FAILED, PENDING) | SUCCESSFUL |
payment_type | Payment method used for the transaction | 1695193758 |
datetime | Transaction timestamp in YYYY-MM-DD HH:MM:SS format | 2023-09-20 10:09:36 |
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