Skip to main content

Create subscription 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" and "0" for URL, Whatsapp, Email
"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": "1" // "0" for Quick invoice , "1" for subscription invoice
"language" : "en", // "en" for english , "ar" for arabic
"expiresAt": "YYYY-MM-DD" // invoice expiry date
"frequency": "1" // Monthly
"noofRecurrence": "1" // No of recurrances
"SubscriptionType" : "1" // subscription Type - "1" - On Demand" , "0" - "Auto Payments"
"startDate": "YYYY-MM-DD" // subscription start 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

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
  • 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 👇
✅ Yes
expiresAtPass invoice expiry date "YYYY-MM-DD" ✅ Yes
subscription

Pass "1" for subscription invoice

✅ Yes
frequency

Pass "1" for monthly subscription

✅ Yes
noofRecurrence

Pass the value to capture number of times. Eg: "1" time in a month

✅ Yes
SubscriptionType
  • Pass "0" for "ON Demand", Merchant needs to capture through API
  • Pass "1" for "Auto Payments", Hesabe Will capture based the date & number of Recurrence
✅ Yes
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.