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 Name | Description | Required |
---|---|---|
merchantCode | Pass the merchant code | ✅ Yes |
mobileNumber | Pass the customer mobile number | ✅ Yes |
customerName | Pass the customer name | ✅ Yes |
amount | Pass the invoice amount | ✅ Yes |
countryCode | Pass the mobile number country code | ✅ Yes |
invoiceType |
| ✅ Yes |
invoiceSubType |
| ✅ Yes |
allocatePayType |
| ✅ Yes |
expiresAt | Pass invoice expiry date "YYYY-MM-DD" | ✅ Yes |
subscription | Pass | ✅ Yes |
frequency | Pass | ✅ Yes |
noofRecurrence | Pass the value to capture number of times. Eg: "1" time in a month | ✅ Yes |
SubscriptionType |
| ✅ Yes |
language |
| ⚠️ Optional |
description | Pass invoice description details | ⚠️ Optional |
itemsList | Pass 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
Types | Description | Value |
---|---|---|
SMS | Send an invoice link to the customer via SMS | "0" |
Share the invoice link with the customer via WhatsApp | "1" | |
Send the invoice link to the customer via email | "2" | |
URL | Copy and share the invoice link through any platform | "3" |
📌 List of payment types
Payment Method Types | Value |
---|---|
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
- 200
- 404
- 500
Invoice created successfully. Decrypt the server response to view the result.
Not able to create invoice, Unauthorized or Permission Denied
Internal Server Error – An unexpected error occurred on the server while processing the request. This may be due to a temporary issue or a server-side malfunction. Please try again later or contact support if the issue persists.