Simple Order Flow with KamioKash API
The flow for placing a simple voucher order through the KamioKash API, from the view of an end user in a customer application.
This document describes the interaction flow for placing a simple voucher order through the KamioKash system, from the perspective of an end user interacting via a customer application. It details both the successful "happy path" and failure handling mechanisms.
๐งฉ Components Involved
- User: The end user initiating the order.
- Customer App: The frontend or interface where the user interacts.
- Customer API: The backend API maintained by the customer, acting as a middle layer.
- KamioKash API: The external rewards platform API used to fulfill the voucher.
- Customer DB: The customer's internal database used to persist order data.
โถ๏ธ Sequence of Events
1. Order Initiation
User โ Customer App: The user initiates an order (e.g., clicks a "Redeem Now" button).Customer App โ Customer API: SendsPOST /order.
2. Voucher Request
Customer API โ KamioKash API: SendsPOST /order/simpleto request a voucher.
โ Happy Path: Voucher Code Issued
KamioKash API โ Customer API: Responds with{ voucherCode }.Customer API โ Customer DB: Stores thevoucherCode.
If storage succeeds:
Customer API โ Customer App: Returns{ voucherCode }.Customer App โ User: Displays the voucher code.
๐ Note: User sees the exact voucher code that was stored in the database.

โ Failure Handling
A. Failure to Store Voucher Code
If saving the voucher code fails:
Customer API โ KamioKash API: SendsDELETE /orderto roll back.KamioKash API โ Customer API: Confirms deletion.Customer API โ Customer App: Returns an error.Customer App โ User: Shows error message.
๐งช Test Case: Simulate DB failure and verify rollback on KamioKash.
B. KamioKash Fails or No Voucher Returned
If KamioKash responds with an error or no voucher code:
KamioKash API โ Customer API: Returns an error or empty result.Customer API โ Customer App: Sends an error response.Customer App โ User: Shows a failure message.
๐งช Test Case: Assert correct error propagation from KamioKash to the user.
๐ Testing & Observability
- โ Confirm rollback logic triggers if DB storage fails.
- โ Ensure voucher shown to user matches stored value.
- โ Validate clear error messaging.
- โ Monitor external API success/failure rates.
- โ Retry logic and idempotency considerations.

โ Summary
This flow ensures:
- Reliable voucher issuance.
- Safe rollback on failure.
- Clear user feedback.
- Data consistency between systems.
Integrating with KamioKash requires careful attention to both success and error paths to deliver a seamless user experience.