curl -H "api-key: 6f1c2a9e-4b7d-4e0a-9c55-2d8f3b1a7e10" \
-H "Content-Type: application/json" \
-d '{"action":"printVoucher","operator":"orange","value":5}' \
https://apitest.tunimobile.com/v1/voucher/do_action
{
"status": "success",
"code": 200,
"message": "OK",
"data": {
"id": 987654,
"cartNumber": "12345 67890 12345",
"serieNumber": "0012345678",
"operator": "orange",
"value": 5,
"expireAt": "2027-06-30 00:00:00",
"printedAt": "2026-10-28 10:15:03",
"size": "standard",
"logo": "https://api.tunimobile.com/images/avatars_bw/123.png",
"barcode": "6191234567890",
"footer": "Powered By TuniMobile.com",
"operatorLogo": "https://api.tunimobile.com/images/operator/orange_5.jpg"
}
}
{
"status": "error",
"code": 400,
"message": "Bad Request",
"error": { "details": "Solde de la boutique insuffisant" }
}
Vouchers
Generate a voucher
Sell a voucher: reserve it for this terminal and debit the shop balance.
curl -H "api-key: 6f1c2a9e-4b7d-4e0a-9c55-2d8f3b1a7e10" \
-H "Content-Type: application/json" \
-d '{"action":"printVoucher","operator":"orange","value":5}' \
https://apitest.tunimobile.com/v1/voucher/do_action
{
"status": "success",
"code": 200,
"message": "OK",
"data": {
"id": 987654,
"cartNumber": "12345 67890 12345",
"serieNumber": "0012345678",
"operator": "orange",
"value": 5,
"expireAt": "2027-06-30 00:00:00",
"printedAt": "2026-10-28 10:15:03",
"size": "standard",
"logo": "https://api.tunimobile.com/images/avatars_bw/123.png",
"barcode": "6191234567890",
"footer": "Powered By TuniMobile.com",
"operatorLogo": "https://api.tunimobile.com/images/operator/orange_5.jpg"
}
}
{
"status": "error",
"code": 400,
"message": "Bad Request",
"error": { "details": "Solde de la boutique insuffisant" }
}
Reserves a voucher for this terminal, marks it
printed and debits the shop balance. Print the returned data right away, then call Confirm a printed voucher.
Do not retry
printVoucher automatically after a timeout: each successful call sells a new voucher. Check the voucher history first, then use reprint if the voucher was already generated.Headers
string
required
The terminal API key.
Body
string
required
printVoucherstring
required
tt, orange or ooredoo.number
required
1 or 5 (TND).Response
integer
Voucher id. Keep it for reprint and confirm reprint.
string
Recharge code to print, grouped by 5 digits.
string
Operator of the voucher.
number
Face value in TND.
string
Expiry date of the voucher.
string
Sale date and time.
string
Ticket layout for this terminal.
string
Shop logo (black and white) to print on the ticket.
string | null
Shop barcode for this operator and value, or
null.string
Text to print at the bottom of the ticket.
string
URL of the operator/value image.
Errors
| HTTP | error.details | Meaning |
|---|---|---|
400 | apiKey not found | api-key header missing |
400 | Terminal not found | Unknown API key |
400 | Terminal not active | Terminal disabled by the shop or an admin |
400 | operator not found | operator not in tt, orange, ooredoo |
400 | value not found | value not 1 or 5 |
400 | Solde de la boutique insuffisant | Balance too low |
400 | Buy price not found | No price configured for this product. Contact support. |
404 | Voucher not found | Out of stock for this operator and value |
404 | Session not found | No session for this terminal. Call Open / close a sales session. |
404 | something_went_wrong | No clean voucher found after several attempts. Try again. |
curl -H "api-key: 6f1c2a9e-4b7d-4e0a-9c55-2d8f3b1a7e10" \
-H "Content-Type: application/json" \
-d '{"action":"printVoucher","operator":"orange","value":5}' \
https://apitest.tunimobile.com/v1/voucher/do_action
{
"status": "success",
"code": 200,
"message": "OK",
"data": {
"id": 987654,
"cartNumber": "12345 67890 12345",
"serieNumber": "0012345678",
"operator": "orange",
"value": 5,
"expireAt": "2027-06-30 00:00:00",
"printedAt": "2026-10-28 10:15:03",
"size": "standard",
"logo": "https://api.tunimobile.com/images/avatars_bw/123.png",
"barcode": "6191234567890",
"footer": "Powered By TuniMobile.com",
"operatorLogo": "https://api.tunimobile.com/images/operator/orange_5.jpg"
}
}
{
"status": "error",
"code": 400,
"message": "Bad Request",
"error": { "details": "Solde de la boutique insuffisant" }
}