Create a customer

POST
/api/direct-payment/customer

Base URL

Sandbox Base URL

Strictly for sandbox testing. Never use the sandbox URL in your production environment.
https://sandbox.hesabe.com

Create a customer record before initiating a VERIFY session or checkout. Store the returned id as customer_id for future checkout sessions.

Header Parameters

accessCode*string

Pass the merchant access code issued by Hesabe

Content-Type*string

application/json

Request Body

application/json
  1. body
data*string

Convert payload JSON object to encrypted string and send it to the server

Sample Encryption and Decryption Process:

The following steps demonstrate how to integrate with this API using sandbox credentials.

Step 1: Create JSON Object

{  "merchantCode": "842217",  "name": "Ahmed Al-Mansouri",  "email": "ahmed@example.com",  "mobile_number": "12345678"}

Payload Details:

Contains the list of parameters and their corresponding values required to make the API request.

Field NameDescriptionRequired
merchantCodePass the merchant code provided by HesabeYes
namePass the customer full nameYes
emailPass the customer email addressYes
mobile_numberPass the customer mobile number (Min 8 & Max 10 digits)Yes

Step 2: Convert the JSON object into an encrypted string format and post to Hesabe

{  "data": "0e7898bd7464d0c402fe8a949d9cbf9b4385ce35e00b491d6b8610d6d3a3ac76de3a7430ae066c72c1da215d7b627a58bee9e67331ef164caba1ccdd6bda8df9e982d2f6ce4ec412b7410b3b846fa0d07c75034135ece28f51b95b10dcda2d50accb3feadbc8be83dd03aa2ed17f6e08"}

Step 3: Receive encrypted response from Hesabe:

{  "response": "60a8f6241932227b840a9f5e36987f4da8391cf5ed4b4f066f27c91f55ae5116701a5af220c8d309c57bace4cdb855a39dc1fc69cdab56f5e883eb75425a39d479cb519b5d53cc36ec8e7f7e23f2b6c248bb9bdfec833c7e88496cab985ed23044efcf73e9305d1891c148c645f00837f8a162cae69b21fdc940947dbe4d2550edf6416b6f8593e607b020e431ea98ba154f5f9b05ee80b67026cfc8243c0c51c0d8fa77588210cdc45ed29e6c869d0b1a329104cb80c7795b4b0a8ee55e99c8"}

Step 4: Decrypt the API response and view the JSON output

{  "status": true,  "message": "Customer created successfully",  "data": {    "customer_id": "4117", // [!code highlight]    "name": "Ahmed Al-Mansouri",    "mobile_number": "12345678",    "email": "ahmed@example.com"  }}

Response Body

Customer created successfully

application/json
  1. response
status?boolean
message?string
data?
Example Request
const body = JSON.stringify({  "data": "0e7898bd7464d0c402fe8a949d9cbf9b4385ce35e00b491d6b8610d6d3a3ac76de3a7430ae066c72c1da215d7b627a58bee9e67331ef164caba1ccdd6bda8df9e982d2f6ce4ec412b7410b3b846fa0d07c75034135ece28f51b95b10dcda2d50accb3feadbc8be83dd03aa2ed17f6e08"})fetch("https://sandbox.hesabe.com/api/direct-payment/customer", {  method: "POST",  headers: {    "Content-Type": "application/json",    "accessCode": "c333729b-d060-4b74-a49d-7686a8353481"  },  body})
Example Response
{  "status": true,  "message": "Customer created successfully",  "data": {    "customer_id": 4117,    "name": "Ahmed Al-Mansouri",    "mobile_number": "12345678",    "email": "ahmed@example.com"  }}