Authentication: All endpoints require
Authorization: Bearer <access_token>.External Dependency: Juspay (sandbox: https://sandbox.juspay.in)Wallet Provisioning Flow
The wallet is automatically created after the user’s first login — the app never needs to trigger this.Wallet creation is async — it never blocks the login response. The app should check wallet status before initiating payments. Status transitions:
CREATED → PENDING → IN_PROGRESS → COMPLETED | FAILED | RETRYING.Wallet Status State Machine
Understanding wallet status is critical for app UX — the wallet UI should adapt to each state.| Status | Meaning | App UX Recommendation |
|---|---|---|
CREATED | DB row created; Juspay provisioning not started | Show “Setting up your wallet…” spinner |
PENDING | Background worker picked up job | Show “Setting up your wallet…” spinner |
IN_PROGRESS | Juspay customer created; wallet creation in flight | Show “Almost ready…” |
COMPLETED | Wallet fully active in Juspay | Show balance and top-up button |
RETRYING | Transient failure; retry in progress | Show “Hang on, setting up…” |
FAILED | All retries exhausted; manual intervention needed | Show “Wallet setup failed” with support contact |
GET /wallet
Returns the authenticated user’s wallet summary.The Transcorp wallet identifier assigned by Juspay during provisioning (e.g.
wlm_jUT7wpiZAkpFFvaT). This is the transcorp_wallet_id stored internally. Use this value as the wallet_id path parameter in all subsequent wallet endpoints (/balance, /status, /transactions/history/{n}). Null until creation_status = COMPLETED.Internal provisioning state:
CREATED | PENDING | IN_PROGRESS | COMPLETED | RETRYING | FAILEDLive Juspay status:
ACTIVE | BLOCKED. Null until COMPLETED.Balance in INR. Null until wallet is
COMPLETED. Cached locally — use the /balance endpoint for a live Juspay query.POST /wallet (Idempotent Create)
Explicitly creates a wallet for the authenticated user. This is idempotent — safe to call multiple times. The wallet is normally auto-created on first login, so this endpoint is a fallback for edge cases (e.g. first login failed mid-provisioning).GET /wallet//balance
Fetches fresh balance from Juspay — not a cached value. Use this when displaying the wallet balance screen to ensure the user sees a real-time figure.The
wallet_id path parameter is the transcorp_wallet_id — the wallet identifier on Transcorp’s PPI system, returned by GET /wallet in the wallet_id field (e.g. wlm_jUT7wpiZAkpFFvaT). This ID is assigned by Juspay/Transcorp when the wallet is first provisioned and stored in Aarokya’s database. It is null until creation_status = COMPLETED.This endpoint makes a live API call to Juspay. It may be 200–500ms slower than other endpoints. Use the balance from
GET /wallet (cached) for non-balance screens and this endpoint only for the balance screen.GET /wallet//status
Returns the wallet’s current provisioning status enum only. Lightweight alternative toGET /wallet when you only need to poll the status.
The
wallet_id path parameter is the transcorp_wallet_id from GET /wallet. See the balance endpoint note above for details.GET /wallet//transactions/history/
Returns recent transaction history. Thenumber_of_days path parameter filters by recency. The wallet_id is the transcorp_wallet_id from GET /wallet.
| Value | Behaviour |
|---|---|
0 | All history (no time filter) |
1–365 | Entries from the last N days |
> 365 | Returns 400 NUMBER_OF_DAYS_OUT_OF_RANGE |
< 0 | Returns 400 NUMBER_OF_DAYS_OUT_OF_RANGE |
POST /nh/payment/session — Create Payment Session
Single endpoint for both wallet top-up and insurance purchase. Thetransaction_type field determines the Juspay session configuration.
Payment Flow
Key Differences Between Transaction Types
| WALLET_TOPUP | INSURANCE | |
|---|---|---|
| Juspay session config | Includes payment_rules.load_money | No payment_rules |
| Money destination | User’s health wallet (Transcorp) | Narayana Health |
| Status check path | wallet.topup.status field | Top-level status field |
CHARGED maps to | SUCCESS via topup status | SUCCESS directly |
| Post-success action | Refresh wallet balance display | Call POST /insurance/purchase |
GET /nh/payment/order-status — Poll Order Status
Poll this endpoint until a terminal status is returned. Thepoll_interval_seconds field in the response tells you how long to wait before the next poll.
PENDING | SUCCESS | FAILED | CANCELLEDPENDING— payment is being processed; keep pollingSUCCESS— payment confirmed; proceed with post-payment actionFAILED— payment failed; show failure screen with retry optionCANCELLED— user cancelled; return to previous screen
Seconds to wait before the next poll. Configured via
app_config table (PAYMENT_STATUS_POLL_INTERVAL = 5). Respect this value — do not poll faster than specified.Polling Implementation
Post-Payment Actions
After receivingSUCCESS, the app must perform a follow-up action depending on transaction_type:
transaction_type | SUCCESS → | Action |
|---|---|---|
WALLET_TOPUP | Balance updated in Juspay | Call GET /wallet/{id}/balance to refresh displayed balance |
INSURANCE | Payment received by NH | Call POST /insurance/purchase with the order_id to create the policy record |