Skip to main content

Create invoice

POST 

/api/v1/invoice

To create invoices instantly and deliver them via link or SMS

🔋 Sample Request Payload

  {
"merchantCode": "842217", // Pass merchant code
"mobileNumber":"66666666",
"customerName": "TEST",
"referenceNumber": "1234",
"amount": "280.000", // Pass three decimal value
"countryCode": "+965", // Mobile number country code
"invoiceType": "1" , // Invoice type "1" for SMS invoice and "0" for URL sharing
"invoiceSubType": "0", // "0" - SMS , "1" - WhatsApp, "2" - Email, "3" - URL
"description": "Invoice testing",
"customerEmail": "test@gmail.com", // Pass customer email if invoiceSubType is "2"
"allocatePayType":[] // (Eg - "1" KNET, "2" - MPGS etc)
"itemsList": [] // (Eg - For products / check below sample payload)
"subscription": "0" // "0" for Quick invoice , "1" for subscription invoice
"language" : "en", // "en" for english , "ar" for arabic
"expiresAt": "YYYY-MM-DD" // invoice expiry date
}

🎯 Note: Payload must be encrypted before being sent to the server. To access the response data, decrypt it upon receiving the response from the server

⚡️ Payload Details

  • Based on the payment gateway subscription from Hesabe
  • Pass subscribed payment method number in an array format. Eg: [1,2,5,10]
  • Check below "List of payment types table" for more information 👇
Field NameDescriptionRequired
merchantCodePass the merchant code✅ Yes
mobileNumberPass the customer mobile number✅ Yes
customerNamePass the customer name✅ Yes
amountPass the invoice amount✅ Yes
countryCodePass the mobile number country code✅ Yes
invoiceType
  • "0" - URL sharing
  • "1" - SMS invoice
✅ Yes
invoiceSubType
  • "0" - SMS
  • "1" - WhatsApp
  • "2" - Email
  • "3" - URL
✅ Yes
allocatePayType✅ Yes
expiresAtPass invoice expiry date "YYYY-MM-DD" ✅ Yes
subscription
  • "0" - Quick Invoice
  • "1" - Subscription invoice
  • Defalut is "0"
⚠️ Optional
language
  • "en" - For english invoice
  • "ar" - For arabic invoice
  • Defalut is "en"
⚠️ Optional
descriptionPass invoice description details ⚠️ Optional
itemsListPass product details in array of objects, Products total amount should not be less than total invoice amount. Check below for more details 👇 ⚠️ Optional

🔋 Sample "itemsList" payload

[
{
"itemTitle": "Iphone", // product name
"rate":"120.000", // unit amount
"quantity": "1", // product qty
"amount": "120.000" // Final amount
},
{

"itemTitle": "Iphone 13", // product name
"rate":"160.000", // unit amount
"quantity": "1", // product qty
"amount": "160.000" // Final amount
}
]

📌 List of invoice sub types

TypesDescriptionValue
SMSSend an invoice link to the customer via SMS"0"
WhatsAppShare the invoice link with the customer via WhatsApp"1"
EmailSend the invoice link to the customer via email"2"
URLCopy and share the invoice link through any platform"3"

📌 List of payment types

Payment Method TypesValue
KNET"1"
MPGS"2"
CYBS"5"
AMEX"7"
MPGS AMEX"8"
MPGS Apple Pay"9"
CYBS Apple Pay"10"
KNET Debit Apple Pay"11"
KNET Credit Apple Pay"12"
KNET Apple Pay International"13"
AMEX Apple Pay International"14"
Google Pay"16"

Request

Responses

Invoice created successfully. Decrypt the server response to view the result.