Skip to Content
RewardsOrders

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: Sends POST /order.

2. Voucher Request

  • Customer API โ†’ KamioKash API: Sends POST /order/simple to request a voucher.

โœ… Happy Path: Voucher Code Issued

  • KamioKash API โ†’ Customer API: Responds with { voucherCode }.
  • Customer API โ†’ Customer DB: Stores the voucherCode.

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.

Simple Flow


โŒ Failure Handling

A. Failure to Store Voucher Code

If saving the voucher code fails:

  • Customer API โ†’ KamioKash API: Sends DELETE /order to 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.

Error Flow


โœ… 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.

On this page