How to use Orders API
Once a user places an order, your app still needs to know what happened to it. Is there an order already in progress? What’s in the user’s order history? What’s the status of one specific order? Can the user back out before paying? The Order APIs answer all four questions.
What We’ll Build
A “My Orders” experience: an active-order check before checkout, a full order history list, a single order details/status view, and a cancel action.
Authentication Headers
These APIs support both onboarding paths from Authentication APIs. The headers you pass depend on which path your integration uses.
Auth Reliance
Transak Onboarding
Pass these headers on every order API call when your platform owns the user’s authentication:
Step 1 — Get Active Orders
Call this before letting a user start checkout. An active order is one that hasn’t reached a final state (COMPLETED, CANCELLED, FAILED, REFUNDED, or EXPIRED) — see the full list on How to Track Order Status. If one exists, resume it or offer to cancel it instead of creating a duplicate order.
How to call and use the response
Sample Code
Step 2 — Get Orders
Fetch the user’s complete order history — every order they’ve ever placed, regardless of status. Use this to render an order list or transaction history screen.
How to call and use the response
Sample Code
Step 3 — Get Order By ID
Fetch a single order using the orderId returned from checkout, from Get Orders, or from Get Active Orders. Use this for an order details screen, or poll it on an interval to track a specific order’s status until it reaches a final state.
How to call and use the response
Sample Code — single fetch + polling
Step 4 — Cancel Order
Cancels an order that hasn’t finished payment yet — useful when the user changes their mind, enters incorrect details, or hits a payment issue.
A cancelled order cannot be reversed. Once cancelled, the user must place a new order.
How to call and use the response
Sample Code
Full Flow (Putting It Together)
useOrderManagement.ts
Order APIs
Returns any order that hasn’t reached a final state — must be completed or cancelled before a new one can be placed.
Returns the user’s full order history, including completed, cancelled, and failed orders.
Returns the details and current status of a single order.
Cancels an order that hasn’t finished payment yet. Cannot be reversed.