Skip to main content

๐Ÿ”— Integrating With Your Webhook

๐Ÿ”” Webhook Integrationโ€‹

๐Ÿ””

Real-time Transaction Updates

Implement a webhook to receive real-time transaction updates by creating a POST API endpoint designed to accept transaction parameters. Include your API URL in the "webhookUrl" variable along with other required parameters as specified in the Hesabe developer portal.

๐Ÿ“‹ Webhook Implementation Stepsโ€‹

๐ŸŒ API Endpointsโ€‹

๐ŸŒ Environment๐Ÿ”— API URL
๐Ÿงช Sandbox / Testhttps://sandbox.hesabe.com/checkout
๐Ÿš€ Production / Livehttps://api.hesabe.com/checkout

๐Ÿ“‹ Request Parametersโ€‹

๐Ÿท๏ธ Field๐Ÿ“‹ Type๐Ÿ“ Description
amount NumericAmount in currency
currency StringISO currency code
responseUrl StringRedirect URL on success
failureUrl StringRedirect URL on failure
merchantCode NumericAssigned by Hesabe
paymentType Numeric0 = Indirect, 1 = KNET, 2 = Visa/MasterCard, 7 = Amex, 9 = Apple Pay, 15 = Recurring / Subscription Method
version StringAPI version (e.g., 2.0)
orderReferenceNumber StringYour reference/order ID
variable1-5 StringOptional key-value pairs (Label__Value)
name StringCustomer name
mobile_number Numeric (8)Customer mobile (no country code)
email StringCustomer email
saveCard BooleanSave card for tokenization
cardId StringTokenized card ID
authorize BooleanAuthorization-only transaction
webhookUrl StringYour endpoint for receiving payment status
1Create POST API Endpoint

Create a POST API endpoint in your application to receive transaction parameters

2Add Webhook URL

Include your API URL in the "webhookUrl" variable when initiating payment requests

3Process Webhook Data

Handle incoming webhook data to update your system with transaction status

๐Ÿ“„ Example Webhook Responseโ€‹

For testing purposes, you can refer to the example webhook response provided below:

{
"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โ€‹

๐Ÿท๏ธ Field Name๐Ÿ“ Description๐Ÿ’ก Example Value
token
Unique transaction identifier returned by Hesabe84221716951937729753667644493
amount
Transaction amount with decimal precision49.000
reference_number
Merchant's order reference number1695193758
status
Transaction status (SUCCESSFUL, FAILED, PENDING)SUCCESSFUL
payment_type
Payment method used for the transactionKNET
datetime
Transaction timestamp in YYYY-MM-DD HH:MM:SS format2023-09-20 10:09:36
โœ…

Benefits of Webhook Integration

This webhook will enable your system to receive real-time transaction updates in a structured format, allowing for immediate processing, automatic order fulfillment, and instant notification of successful transactions.