Create Customer

Create a customer record before initiating a VERIFY session

POST
/api/v2/customer

Header Parameters

accessCodestring

Pass the merchant access code issued by Hesabe

Content-Typestring

application/json

datastring

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": {
    "id": 4078, 
    "customer_id": "84222861", 
    "name": "Ahmed Al-Mansouri",
    "mobile_number": "12345678",
    "email": "ahmed@example.com"
  }
}

Response Body

application/json

application/json

application/json

application/json

application/json

const body = JSON.stringify({  "data": "0e7898bd7464d0c402fe8a949d9cbf9b4385ce35e00b491d6b8610d6d3a3ac76de3a7430ae066c72c1da215d7b627a58bee9e67331ef164caba1ccdd6bda8df9e982d2f6ce4ec412b7410b3b846fa0d07c75034135ece28f51b95b10dcda2d50accb3feadbc8be83dd03aa2ed17f6e08"})fetch("https://sandbox.hesabe.com/api/v2/customer", {  method: "POST",  headers: {    "Content-Type": "application/json",    "accessCode": "c333729b-d060-4b74-a49d-7686a8353481"  },  body})
{
  "status": true,
  "message": "Customer created successfully",
  "data": {
    "id": 4078,
    "customer_id": "84222861",
    "name": "Ahmed Al-Mansouri",
    "mobile_number": "12345678",
    "email": "ahmed@example.com"
  }
}
{
  "status": false,
  "message": "Invalid request data — please check your payload and try again",
  "response": null
}
{
  "status": false,
  "message": "Unauthorized — the provided accessCode is missing or invalid",
  "response": null
}
{
  "status": false,
  "message": "Forbidden — you do not have permission to access this resource",
  "response": null
}
{
  "status": false,
  "message": "Internal Server Error — an unexpected error occurred, please try again later",
  "response": null
}