POS Invoice

Generate new POS invoices for terminal-based transactions

POST
/api/v1/merchant/smartpos-transaction
AuthorizationBearer <token>

Pass access token obtained from login endpoint

In: header

Header Parameters

accessCodestring

Pass the merchant access code issued by Hesabe

Acceptstring

application/json

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",
  "customer_name": "Salman",
  "customer_email":"",
  "customer_phone":"",
  "amount":0.100,
  "terminal_id":"29708454",
  "invoice_number":"",
  "description":"test"
}

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
customer_namePass the customer nameYes
amountPass the invoice amountYes
terminal_idPass the Terminal IDYes
customer_phonePass customer mobile numberOptional
customer_emailPass customer email addressOptional
invoice_numberPass the invoice numberOptional
descriptionPass invoice description detailsOptional

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

{
  "data": "0e7898bd7464d0c402fe8a949d9cbf9b191a5c36b416dd227c080e9e34889e3789f0a48c2a935932bc2698cfae0745a892b6fffc18bf86638fda8dcebd9e216416e552057bfe18900f0fd3e52c8f2d87ae1a2c74c68ae67b941d1f55e6a1ad3fbbbb043d5be213831c86448d163a473601f52f115944b2fe5f218424c0eaa54aa7af4880acf1ddd6e514617670691a3f6f539422c79992b3d6ea3cb6d1d3ead2fe3656b2b7a66ce06649af3577536865"
}

Step 3: Receive encrypted response from Hesabe:

{
  "response": "60a8f6241932227b840a9f5e36987f4d9bc63e437527339368fb9404881024705b54b601ffab92c0947e27fdeb797a32ebd1c05e6a7a67d93280ee6b8e82dbcd3f1a46b9e68a1294852f28c4a580ab312ece99144c047154e2a54ef3a18a27e531475d17d549df9af55ac2a4b8d84c9270110d5678cd01078680ef8fec7b9f457fda931bd21f51c6ebbc571daff98a86c072a94375e78333cb497d1baa1d918ceaac9f61c2fc891579b344c8bfce4d26ab48a95229975b02da04e064bfe75d7f2b26fc8a798f71b0cff626fef56a3d27261144944cded3032134a10e5a319f8a2c2d0a7dfa5074dcebfa84e1a6d6ce8a6795300740493d680f2d4f31b8be9be50878d6f478284b6edab9aaae4866d1758d93fd1c2dedeb5b3244e4ea98d080792ba82df17fd5484b26cdf6c59e10a96abad12d7c9d41e8e4ee52cd1089e8b10f1490fa2419f867933606f1b0280b3bf091b8185108761126534f1aa37224fe6e0939202b47bfc17a2109bb045f2f100755c947d73c58dc4ace60b6a2476519af5d6521d3f49e76335b673df868e7376ff26a2995e21c7b42118c4c4292ca1e54929cd40cba798a1ff25639f0542d32975cd6f57bf885692469284773db632419b07195358954d4592b0f8b7e994924cdb3dad0f3cf89cc81f0fd8ab34e7f7bd9"
}

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

{
  "status": true,
  "message": "POS invoice created successfully",
  "response": {
    "id": 267,
    "transaction_id": "297084548417629359279347779043",
    "invoice_number": "",
    "amount": "0.1",
    "terminal_id": "29708454",
    "merchant_id": 84,
    "merchant_name": "TestHome1",
    "terminal_name": "A99",
    "customer_name": "Salman",
    "customer_email": "",
    "customer_phone": "",
    "description": "test",
    "status": 0,
    "created_by": 84,
    "created_by_name": "test",
    "created_at": "2025-11-12 11:25:27",
    "updated_at": "2025-11-12 11:25:27"
  }
}

Response Body

application/json

application/json

application/json

application/json

const body = JSON.stringify({  "data": "0e7898bd7464d0c402fe8a949d9cbf9b191a5c36b416dd227c080e9e34889e3789f0a48c2a935932bc2698cfae0745a892b6fffc18bf86638fda8dcebd9e216416e552057bfe18900f0fd3e52c8f2d87ae1a2c74c68ae67b941d1f55e6a1ad3fbbbb043d5be213831c86448d163a473601f52f115944b2fe5f218424c0eaa54aa7af4880acf1ddd6e514617670691a3f6f539422c79992b3d6ea3cb6d1d3ead2fe3656b2b7a66ce06649af3577536865"})fetch("https://merchantapisandbox.hesabe.com/api/v1/merchant/smartpos-transaction", {  method: "POST",  headers: {    "Content-Type": "application/json",    "accessCode": "c333729b-d060-4b74-a49d-7686a8353481",    "Accept": "application/json"  },  body})
{
  "status": true,
  "message": "POS invoice created successfully",
  "response": {
    "id": 267,
    "transaction_id": "297084548417629359279347779043",
    "invoice_number": "",
    "amount": "0.1",
    "terminal_id": "29708454",
    "merchant_id": 84,
    "merchant_name": "TestHome1",
    "terminal_name": "A99",
    "customer_name": "Salman",
    "customer_email": "",
    "customer_phone": "",
    "description": "test",
    "status": 0,
    "created_by": 84,
    "created_by_name": "test",
    "created_at": "2025-11-12 11:25:27",
    "updated_at": "2025-11-12 11:25:27"
  }
}
{
  "status": false,
  "message": "Request not found, Please verify the request data",
  "response": null
}
{
  "message": "Internal server error occurred"
}
{
  "status": false,
  "code": 506,
  "message": "Invalid Request Data",
  "response": null
}