Voucher Purchase Simulation
π« Simulating Voucher Purchase and Token Retrieval Using Dummy Products#
This guide explains how to test the voucher flow using dummy products and the CSQ API's Prepaid Vouchers endpoints. It is designed for developers who want to safely simulate voucher purchases, token responses, and conditional queries without triggering real transactions or connecting to external providers.
π¦ Dummy Products for Voucher Simulation#
Product ID | Product Name | Behavior Summary |
---|
9991 | DummyPin | Returns a PIN with full additionalData |
9994 | DummyVoucherADTrue | Randomly returns extraInfo or hasAdditionalData = true , the latest requiring an additional query for retreiving the voucher code and information. Randomly, this additional query may return a 404 - not found result or a valid result. |
9995 | DummyVoucherADFalse | Always returns a simple PIN code and hasAdditionalData = true , which requires and additional query for retrievin the extra info. |
These dummy products help simulate different backend responses and conditional UI flows.
π Voucher Simulation Flow#
1.
(Optional) Get Available Dummy Products
4.
If hasAdditionalData = true
: Query Additional Data
πΉ Step 1: Get Available Dummy Products#
Method
GET /pre-paid/vouchers/products/{terminalId}/{operatorId}
You can use operatorId = 9991
, 9994
, or 9995
, althoug none of this products has a dynamic behaviour.Purpose
Retrieves voucher definitions for the selected operator. This is typically used to populate a product list or validate which dummy product is enabled.β
No account
or additional parameters are required β this endpoint is not tied to any user-specific input and operates independently of account context.
πΈ Step 2: Simulate Voucher Purchase#
Method
POST /pre-paid/vouchers/purchase/{terminalId}/{operatorId}/{localReference}
{
"amountToSendX100": 500,
"localDateTime": "2025-07-08T10:00:00Z",
"account": "600000000"
}
Dummy voucher Behavior Based on account
SuffixEnds With | Response Outcome |
---|
000 | β
Purchase Success |
001 | β Error 971 |
002 | β Error 990 |
other | β Error 991 |
Tip: You can use real-looking phone numbers to drive specific results.
β οΈ Note:
While dummy voucher products usually accept simplified payloads with just the account
field, this isnβt guaranteed for real products. The actual structure and required fields can vary widely depending on the operator, country, or service type β including fields like receiverEmail
, documentNumber
, or dynamic product selections.β
To ensure correct integration, always follow the implementation guidance provided by the commercial and support teams, who will indicate the exact payload requirements for each product.
πΈ Step 3: Retrieve Additional Data#
Purpose
Fetches additional metadata linked to the voucher token received during purchase. This may include fields like expirationDate
, instructions
, or other product-specific attributes.β οΈ Warning
This endpoint should be called only if the purchase response includes the flag hasAdditionalData: true
. It allows clients to fetch the full content or presentation details of the voucher after it has been issued.
π Behavior in Dummy Products#
operatorId | Behavior Summary |
---|
9991 | Returns additionalData directly with token, so there is no need to use this additional data query. Therefore you should not use this query method. |
9994 | Requires this step if hasAdditionalData = true , so you must first check hasAdditionalData value in the purchase response. |
9995 | Always requires this step to complete the flow . |
{
"rc": 0,
"items": [
{
"resultcode": 0,
"resultmessage": "Voucher retrieved successfully",
"redeemAccount": "james.may@example.com",
"redeemInstructions": "Use this code at checkout on the partner site.",
"redeemCode": "DUMMY-ABC-999",
"expiration": "2025-12-31",
"additionalData": {
"provider": "DummyVouchers Ltd",
"currency": "EUR",
"productName": "Dummy Supermarket β¬10"
}
}
]
}
π§ Use this step to populate confirmation screens or print-ready voucher details.
π§ Developer Notes#
account
suffix drives purchase outcome on dummy products.
localReference
must be consistent across steps
Use the hasAdditionalData
flag to simulate multi-step voucher flows
Simulated errors help test retry, fallback, and UI behavior
Modified atΒ 2025-07-08 13:50:15