"Payment" is the most overloaded word in the e-Stamp flow. It can mean the customer paying you, you paying StampMitra for the stamp, StampMitra paying the state through the issuing side, or you paying for the API calls themselves. A developer who treats those as one thing will eventually debit the wrong balance, show the wrong message or explain the wrong invoice. This page separates them. It explains the three balances behind an e-Stamp integration, how each one is funded, when each one is debited, how GST enters, how to size and monitor the balances, and what the generic payment-intent resource in the reference is really for. It is step seven of the eight-step e-Stamp flow.
The short version, which the rest of the page earns: duty and fees are paid from prepaid wallets at the moment an order is created, and a payment is never the same as an issued stamp.
Three balances, three jobs
An organisation integrating e-Stamp deals with three balances. They are kept apart on purpose.
| Balance | What it pays for | GST treatment | How you fund it | Debited when |
|---|---|---|---|---|
| API credit wallet | StampMitra's API fee on metered calls: duty calculation, parties, and per-order fee where enabled | Charged with GST, with GST invoices | Top-up from the dashboard, with a minimum top-up before GST | A metered call succeeds |
| Service Fee Wallet | The procurement and convenience fees on an e-Stamp order | GST is added at top-up. The order debits the fee net of GST | POST /v1/service-fee-wallet/topup | An order is created |
| Stamp Duty Wallet | The statutory duty itself | None. No GST is ever added | POST /v1/stamp-duty-wallet/topup | An order is created |
The duty is the government's money and passes through at cost. The fees are StampMitra's and the issuing side's service charges and carry GST. The API fee is StampMitra's charge for using the API. Three different kinds of money, three balances, and an order creation that touches two of them at once.
The Stamp Duty Wallet
The Stamp Duty Wallet holds money for statutory duty. Three routes cover it, all under the base URL https://api-b2b.stampmitra.in.
| Route | Purpose | Scope | Rate limit |
|---|---|---|---|
GET /v1/stamp-duty-wallet | Current balance | stamp-duty-wallet.read | 60 per 60 s |
POST /v1/stamp-duty-wallet/topup | Start a top-up | stamp-duty-wallet.topup | 20 per 60 s |
GET /v1/stamp-duty-wallet/transactions | Paginated ledger | stamp-duty-wallet.read | 60 per 60 s |
export STAMPMITRA_API_KEY="sk_test_xxxxxxxxxxxx"
export BASE="https://api-b2b.stampmitra.in"
curl -s "$BASE/v1/stamp-duty-wallet" -H "Authorization: Bearer $STAMPMITRA_API_KEY"{ "balance": "1250.00", "currency": "INR" }The balance is a decimal string. Parse it before comparing, and never concatenate it. A top-up takes a baseAmount in rupees, which must be a positive number:
curl -s -X POST "$BASE/v1/stamp-duty-wallet/topup" \
-H "Authorization: Bearer $STAMPMITRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "baseAmount": 5000 }'{
"baseAmount": "5000.00",
"gstAmount": "0.00",
"totalCharged": "5000.00",
"razorpayOrderId": "order_Lm3n4o5p6q7r8s",
"razorpayKeyId": "rzp_live_1234567890abcd"
}The response is not a credited balance. It is the pair of identifiers your front end needs to open Razorpay Checkout. gstAmount is 0.00 because no GST is added to this wallet, so totalCharged equals baseAmount. The values above are illustrative.
POST/v1/payments/intents
Create a payment intent
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
Idempotency-Key | header | Optional idempotency key (1 to 255 characters), kept for 24 hours. The same key and the same request replays the stored response; the same key with a different request is 422 IDEMPOTENCY_KEY_REUSED; the same key while the first request is still running is 409 IDEMPOTENCY_IN_PROGRESS (see Retry-After). |
externalOrderIdrequired | string | Your reference for the order being paid. |
amountMinorrequired | integer | Amount in minor units (paise); positive integer. |
currencyrequired | string | Currency code, at least 3 characters, e.g. INR. |
paymentConnectionIdrequired | string | Id of one of your active payment connections. |
Response fields
| Field | Type |
|---|---|
id | string |
externalOrderId | string |
coreOrderId | null |
amountMinor | number |
currency | string |
status | string |
providerIntentId | string |
createdAt | string |
GET/v1/payments/intents/:id
Get a payment intent
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
Response fields
| Field | Type |
|---|---|
id | string |
externalOrderId | string |
coreOrderId | null |
amountMinor | number |
currency | string |
status | string |
providerIntentId | string |
createdAt | string |
GET/v1/orders/:id/payment
Get an order's payment
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
The Service Fee Wallet
The Service Fee Wallet has the same three routes and adds invoices.
| Route | Purpose | Scope |
|---|---|---|
GET /v1/service-fee-wallet | Current balance | service-fee-wallet.read |
POST /v1/service-fee-wallet/topup | Start a top-up. GST is added on top of baseAmount | service-fee-wallet.topup |
GET /v1/service-fee-wallet/transactions | Paginated ledger | service-fee-wallet.read |
GET /v1/service-fee-wallet/invoices, GET .../invoices/:id | GST invoices for top-ups | service-fee-wallet.invoices.read |
The top-up response shows the GST added:
{
"baseAmount": "500.00",
"gstAmount": "90.00",
"totalCharged": "590.00",
"razorpayOrderId": "order_Pq9r8s7t6u5v4w",
"razorpayKeyId": "rzp_live_1234567890abcd"
}Read it closely, because it explains how GST reaches the books. The customer-facing charge is totalCharged: the base amount plus 18 percent GST. The wallet is credited with the base. When an order later debits the service fee, it debits the amount net of GST, because the GST on that amount was already collected, once, at top-up. That is why the invoices attach to top-ups and not to individual orders. If your finance team asks where the GST on an order's fees was charged, the answer is on the invoice for the top-up that funded the wallet.
Funding a wallet: the Razorpay Checkout sequence
A top-up is a three-party dance: your server, your user's browser and Razorpay. Keep the sequence in mind, since each party owns one step.
- Your server calls the top-up route and receives
razorpayOrderId,razorpayKeyIdandtotalCharged. - Your front end opens Razorpay Checkout with those values, so the person paying completes the payment with Razorpay directly.
- Razorpay confirms the payment to StampMitra. The wallet is credited by that confirmation. Your browser's "payment succeeded" callback is a hint, not the credit.
- Your server reads the balance or the ledger until the top-up appears, and only then lets the user continue.
// Browser: open Checkout with values your server obtained from the top-up route
function openCheckout({ razorpayKeyId, razorpayOrderId, totalCharged }, onDone) {
const rzp = new window.Razorpay({
key: razorpayKeyId,
order_id: razorpayOrderId,
amount: Math.round(Number(totalCharged) * 100), // paise
currency: "INR",
name: "Your company",
handler: () => onDone(), // a hint; confirm on your server before relying on it
});
rzp.open();
}import os, time, requests
BASE = "https://api-b2b.stampmitra.in"
H = {"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"}
def wallet_balance(path: str) -> float:
r = requests.get(f"{BASE}{path}", headers=H, timeout=15)
r.raise_for_status()
return float(r.json()["balance"])
def wait_for_credit(path: str, before: float, expected_increase: float, timeout_s: int = 300) -> bool:
"""Poll the wallet until the top-up lands, or give up and flag it for a person."""
deadline = time.time() + timeout_s
while time.time() < deadline:
if wallet_balance(path) >= before + expected_increase - 0.005:
return True
time.sleep(5)
return FalseNever credit your own "available funds" display from the browser callback. Trust the wallet's balance or ledger. A user can close the tab after paying, and the credit still arrives, so poll on the server and let the user come back to a screen that shows the truth.
Reading the balance and the ledger
Both e-Stamp wallets return the same ledger shape from their transactions routes, paginated with a limit query parameter and a cursor.
curl -s "$BASE/v1/stamp-duty-wallet/transactions?limit=20" -H "Authorization: Bearer $STAMPMITRA_API_KEY"{
"items": [
{
"id": "txn_01",
"type": "TOPUP",
"amount": "5000.00",
"balanceAfter": "6250.00",
"referenceId": "order_Lm3n4o5p6q7r8s",
"description": "Wallet top-up",
"mode": "RAZORPAY",
"createdAt": "2026-10-29T08:55:10.000Z"
}
],
"nextCursor": null
}| Field | What it tells you |
|---|---|
id | The ledger entry id |
type | The kind of movement, for example TOPUP, and debit or refund types for orders |
amount | The movement, as a decimal string |
balanceAfter | The balance after this movement |
referenceId | What caused it: a Razorpay order for a top-up, or an order reference for a debit |
description | A human-readable note |
mode | How the money moved, such as RAZORPAY |
createdAt | When it happened |
The ledger is your reconciliation source. Walk it with nextCursor until it is null, store entries by id, and match debits to orders through referenceId. A nightly job that sums movements and compares them with the balance catches any drift early.
When money moves at order creation
Order creation is where the two e-Stamp wallets are debited, and the sequence matters.
- The order is validated and priced afresh, per line.
- The duty total is debited from the Stamp Duty Wallet.
- The service fee total, net of GST, is debited from the Service Fee Wallet.
- Only then is the order record written.
If step three fails, step two is reversed with a refund entry. If the order cannot be written after both debits, both are credited back. Debits are keyed to the order reference, so a retry with the same idempotency key does not charge twice: at most one live debit exists per wallet and reference, and a retry after a failure that kept the debits reuses them. A retry after a failure that was refunded charges again, since the refund reversed the earlier debit.
A shortfall in either balance refuses the order before anything is written. The answer is a 402 PAYMENT_REQUIRED whose message names the wallet that is short, the Stamp Duty Wallet or the Service Fee Wallet. Top up that wallet. After topping up, retry with the same Idempotency-Key and the same body. Since nothing was created, the retry runs cleanly. The order page covers the create route and its keys.
Sizing the balances
How much to keep in each wallet is a working-capital question with a practical answer. Duty is the large number and fees the small one, so the Stamp Duty Wallet needs the most attention.
| Input | How to get it |
|---|---|
| Orders per day | Your own volume, peak day rather than average |
| Typical duty per order | From your own quotes, by state and article |
| Typical fees per order | From the quote's service charge subtotal, by state |
| Lead time for a top-up | How long your finance process takes to approve and pay |
| Safety margin | A multiple, such as one to two days of peak volume |
A simple rule is: keep at least lead time in days x peak daily need x 1.5 in each wallet, and top up when the balance falls to that floor. The two wallets deplete at different rates, so track them separately. Illustrative arithmetic helps: if peak is 40 orders a day with an average duty of 1,000 and fees of 150, the Stamp Duty Wallet burns around 40,000 and the Service Fee Wallet around 6,000 on a peak day, and with a two-day lead time and a 1.5 margin you would hold about 120,000 and 18,000. These numbers are examples, not recommendations.
Do not size from averages alone. Months have peaks, such as the start of academic and tenancy cycles, and an order refused for a short balance on the busiest day is the most expensive refusal you will have.
Watching burn rate by state and article
Duty is not evenly spread. A product that stamps a few high-value articles in one state can drain the Stamp Duty Wallet quickly, while a product that stamps many low-value articles across states barely moves it. Break your burn rate down by state and article from your own order records, since the ledger's references let you attribute each debit to an order. Two uses follow. A top-up policy tied to the next week's expected mix is more accurate than one tied to last month's average. And an outlier is easy to spot: one order that debits many times the usual duty is either a large legitimate document or a mistaken amount, and worth a second look before it is created. A simple pre-submit rule, such as asking for a second approver above a threshold you set, turns that observation into a control.
Alerts and a low-balance policy
Treat low balance as an operational event with an owner. A reasonable policy has three parts.
- Measure often. A job reads both balances every few minutes during business hours and writes the numbers to your metrics.
- Alert in tiers. A warning when a balance falls to your floor, a page when it is below one day of volume, and a hard stop on new orders if it is below what your largest likely order needs.
- Make top-up easy. A runbook, an approver on call and a saved payment method in your finance process shorten the gap between alert and money.
For the API credit wallet, the dashboard shows a low-balance state, and the platform treats production calls differently once the balance is exhausted. Watch it as well, since an exhausted API credit wallet makes quoting and parties calls fail with a 402 even when both e-Stamp wallets are full.
The API credit wallet and the API fee
Separately from the stamp money, StampMitra charges an API fee for metered calls. For the e-Stamp surface the metered calls are duty calculation, parties, and order creation where the per-order fee is enabled. The fee is ₹5 per charged call on pay-as-you-go before GST, lower on Growth and Scale, and your plan's rate is on the pricing page. It is debited from the API credit wallet, which you top up from the dashboard with a minimum top-up before GST, and which carries GST invoices on the billing page.
Several rules from the pricing page apply: wallets are prepaid only, there is no postpaid or credit, malformed requests rejected with a 400 are not charged, and calls that fail on StampMitra's side or its provider's side are credited back automatically. Sandbox calls never debit the wallet.
Sandbox
Free
Build and test with a sandbox key.
Production API fee
₹5 / call
Pay-as-you-go per successful call, lower on Growth and Scale. Excludes 18% GST. State procurement fee and stamp duty are quoted per order. Full pricing
Access scope
payments.write
Your API key needs this scope to call the endpoint.
Keep this wallet out of your stamp reconciliation. A quote costs the API fee and moves no stamp money, and an order moves stamp money and may or may not carry a per-order API fee. The two ledgers answer different questions.
The generic payment intent
The reference page for payment also documents a generic payment resource, which sounds like it must be central and is not what e-Stamp orders draw from. POST /v1/payments/intents creates a payment intent backed by Razorpay, and GET /v1/payments/intents/:id reads it.
| Field | Meaning |
|---|---|
externalOrderId | Your reference for the order being paid (request) |
amountMinor | The amount in paise, a positive integer (request) |
currency | A currency code, for example INR (request) |
paymentConnectionId | The id of one of your active payment connections (request) |
id, status, providerIntentId, coreOrderId, createdAt | Returned: the intent id, its status such as CREATED, the provider's id, and timestamps |
The scopes are payments.write and payments.read, and the create route accepts an optional Idempotency-Key. The related GET /v1/orders/:id/payment reads the payment attached to a generic order under orders.read. Payment events from the provider reach StampMitra on a server-to-server route that is signature-verified and is never called by your frontend or your backend.
The honest reading is this. The payment-intent resource is the platform's generic building block for gateway payments, tied to the generic order resource. The e-Stamp order routes fund themselves from the two wallets instead. If you integrate the generic resource for another purpose, keep it separate in your code from the wallet flows, and do not model an e-Stamp order as a payment intent plus an order. Ask developer support if you believe your account needs the intent path for stamping.
Payment is not issuance
A successful payment or a successful wallet debit is not an issued stamp. Between the debit and a certificate sit a human review, a placement with the issuing side, generation and verification, which can take time and can fail. StampMitra's service terms say that payment confirmation does not necessarily mean the instrument has been issued, and that you must not represent a payment as an issued instrument until the applicable status is confirmed.
| Your internal state | Evidence | What to show the customer |
|---|---|---|
paid | Wallet debited at order creation, order record exists | "Payment received. Your stamp request is with our team" |
in_review | Order in a pre-placement status | "We are reviewing your request" |
placed | Stamps exist and are progressing | "Your stamp is being generated" |
stamped | Certificate available and saved | "Your stamp is ready" with a download |
refunded or cancelled | Order cancelled, credits seen in the ledger | "Your request was cancelled" and what happens to the money |
Never skip from paid to stamped. The status routes and the certificate route are the only evidence for the last step, as the document access page explains.
Who pays: you, or your customer
Most products sit between a customer and StampMitra, and you choose how the customer's money reaches the wallets. Three patterns are common, and none of them involves StampMitra collecting from your customer directly.
- Pre-funded, absorbed. You keep the wallets topped up and recover the cost inside your own pricing. Simple for the customer, with working capital on your side.
- Pre-funded, passed through. You collect the quote's total from the customer through your own checkout, then rely on your pre-funded wallets for the actual debit. You need a margin of float, and your reconciliation must tie each customer payment to an order and its debits.
- Top-up on demand. You collect from the customer and top up the wallets just in time. This avoids float and adds a delay and a failure mode: the customer has paid, and the top-up has not yet landed.
Whichever you choose, say plainly on your own checkout screen what the customer is paying for, with duty, fees and GST shown as separate lines, because a customer who understands the split rarely disputes it later. Keep your own record of what each customer paid and which order it covered, and decide in advance what happens to the customer's money if an order is cancelled. The platform credits wallets back on a failed creation; what you return to your customer, and how fast, is your policy.
Tying ledgers to orders and invoices
A reliable reconciliation joins four things: your orders, the two e-Stamp ledgers, the Razorpay receipts for top-ups, and the GST invoices. A short daily job is enough to keep them honest.
| Join | Key | What a mismatch means |
|---|---|---|
| Your order to a duty debit | The order reference in the ledger's referenceId | A debit with no order, or an order with no debit |
| Your order to a fee debit | The same reference in the Service Fee ledger | Same, for the fee side |
| A top-up to a Razorpay receipt | razorpayOrderId | A top-up that was paid but never credited, or credited twice |
| A Service Fee top-up to an invoice | The invoice id or the order id on it | A missing invoice, which finance will ask about at month end |
import os, requests
BASE = "https://api-b2b.stampmitra.in"
H = {"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"}
def ledger(path: str):
"""Yield every ledger entry, following the cursor to the end."""
cursor = None
while True:
params = {"limit": 100, **({"cursor": cursor} if cursor else {})}
r = requests.get(f"{BASE}{path}/transactions", headers=H, params=params, timeout=20)
r.raise_for_status()
page = r.json()
yield from page["items"]
cursor = page.get("nextCursor")
if not cursor:
return
def unmatched_debits(path: str, known_references: set[str]) -> list[dict]:
"""Debits whose reference is not one of our orders: worth a human look."""
return [e for e in ledger(path) if e["type"] != "TOPUP" and e["referenceId"] not in known_references]Run the same job for both wallets, and add one more check: the running total of amount by type should explain the current balance. When it does not, stop and escalate with the entry ids, because the cheapest time to fix a ledger question is the day it appears.
Making top-ups safe against double payment
A top-up is a payment initiated by a person. People double-click, refresh and retry, so protect them.
- Disable the button once pressed and show a "payment in progress" state until you have an answer.
- Create your own top-up record before calling the route, with a unique id, the amount, the wallet and who started it, and attach the
razorpayOrderIdwhen you receive it. Then a refresh finds the pending record instead of starting another top-up. - Reuse an open top-up instead of creating a second one for the same purpose within a short window. Each call to the route creates a new Razorpay order, and each can be paid.
- Confirm from the wallet, not the browser. Mark your record complete only when the ledger shows the credit, and keep it "pending" if it has not appeared after the timeout, with an alert.
- Reconcile pending records daily. A top-up pending for more than a day is either unpaid or unreflected, and either deserves a person.
None of this requires anything from StampMitra beyond reading the ledger, so you can build it in an afternoon and test it with recorded fixtures. It is plain discipline around a payment flow, and it prevents the unpleasant case where a customer has paid twice and your records show once.
Who may move money
A top-up route can start a payment, and a wallet read reveals balances. Give them the care that money deserves.
- Separate the keys. The service that creates orders should not hold the top-up scopes, and the service that tops up should not hold the order scopes. A leak of one key then cannot both spend and fund.
- Restrict by network where your plan allows. An IP allowlist on the keys that touch wallets is cheap protection.
- Keep payment secrets out of your own code and logs. The Razorpay key id is a public identifier meant for the browser. Anything secret stays with Razorpay and StampMitra.
- Require approval for large top-ups. Make the amount at which a second approver is needed a documented policy.
- Record who did what. Store the person, the time, the amount, the wallet and the
razorpayOrderIdfor every top-up, and the person who approved it. - Alert on the unexpected. A top-up outside business hours, a burst of top-ups, or a wallet read from an unfamiliar address deserves a message to someone.
These habits are the same ones you would apply to any payment integration, and they matter more here because an order creation spends from the wallets without any further prompt.
Failure modes and what to do
| Situation | Signal | What to do |
|---|---|---|
| A wallet is short at creation | Refused before anything is written, as 402 PAYMENT_REQUIRED naming the wallet | Top up that wallet, retry with the same key |
| The API credit wallet is empty | 402 PAYMENT_REQUIRED on a metered call | Top up from the dashboard, then retry |
| The user closed the tab after paying | No browser callback | Poll the wallet from your server; the credit arrives anyway |
| A top-up never appears | Balance unchanged after a reasonable wait | Check the ledger and your Razorpay receipt, then contact support with the razorpayOrderId |
| A debit appears but no order exists | Ledger shows a debit with an order reference | List orders by your reference; if none, contact support with the reference |
| An order was created and then cancelled | Order status CANCELLED | Watch the ledger for the credit, and do not promise a refund time to your customer |
| Two debits for one order | Two ledger entries with the same reference | Contact support with both ids; do not retry |
Errors and how to react
All errors use { "error": { "code", "message", "requestId" } }.
| Status | Code | When | What to do |
|---|---|---|---|
| 400 | BAD_REQUEST | baseAmount is not a positive number | Fix the amount |
| 401 | UNAUTHORIZED | Missing or invalid key | Fix the key |
| 403 | FORBIDDEN | Valid key without the wallet scope | Add stamp-duty-wallet.read, .topup or the service fee equivalents |
| 404 | NOT_FOUND | No such invoice for your organisation | Check the invoice id |
| 429 | TOO_MANY_REQUESTS | Rate limit exceeded: 60 per 60 s for reads, 20 per 60 s for top-ups | Back off |
| 502 | INTERNAL_ERROR | The wallet service is unreachable | Retry with backoff; do not assume a top-up was or was not started |
A top-up call that times out is a prompt to read the ledger before you call again, since a second call creates a second Razorpay order. Both orders can be paid, and both would credit the wallet, so make the retry decision from the ledger and not from the timeout.
GST, invoices and the accounting view
Three kinds of document matter to your finance team. Invoices for the API credit wallet are on the billing page of the dashboard. Invoices for Service Fee Wallet top-ups come from GET /v1/service-fee-wallet/invoices. The Stamp Duty Wallet carries no GST and no invoice route, because duty is a pass-through of the government's money.
A plain summary of what is taxed: StampMitra's own charges carry 18 percent GST, which is collected at top-up for the Service Fee Wallet and invoiced for the API credit wallet. The statutory duty carries none. How you treat these in your own accounts, and whether any input tax credit is available, depends on your own position, so take that to your accountant. Match each top-up to its invoice by the razorpayOrderId or the invoice id, and archive invoices with the ledger entry that references them.
Sandbox and production
A sandbox key has its own pair of wallets, and they are fake. The Stamp Duty Wallet and the Service Fee Wallet in sandbox are counters kept for your organisation in a separate sandbox ledger. They are not the real wallets, they never touch a payment provider, and nothing in them is money, so the sandbox lets you test the whole money loop for free. This chapter describes how they behave. The order side is on the order page. Wallet calls count too: balance, top-up, ledger and invoice requests all count toward the sandbox limits (10 requests a minute and 200 a day per organisation, and 50 a day per IP address, resetting at midnight IST), the same allowance as quotes and orders, so poll a balance sparingly.
Balances, top-ups and the cap
The first call to either wallet creates both with a starting balance, so you can create an order straight away.
| Item | Sandbox behaviour |
|---|---|
| Starting balance, Stamp Duty Wallet | INR 50,000 of fake credit |
| Starting balance, Service Fee Wallet | INR 5,000 of fake credit |
POST .../topup with baseAmount | Adds that amount instantly, with no checkout and no payment |
| Most one wallet can hold | INR 10,00,000. A top-up past that answers 400 and changes nothing |
GET .../transactions | Newest first, with type SEED, TOPUP, DEBIT or REFUND and mode SANDBOX |
GET /v1/service-fee-wallet/invoices | Empty, because a fake top-up produces no tax invoice |
The sandbox top-up response keeps the production money fields (baseAmount, gstAmount, totalCharged) so your parsing carries over, and adds sandbox: true, credited, balance and a notice. The Service Fee Wallet shows the 18 percent GST on top as production does, but only baseAmount is credited and nothing is charged. There is no razorpayOrderId and no razorpayKeyId, because there is no checkout to open. Branch on sandbox: true in your top-up screen, and keep the production Checkout code behind the live key.
What an order does to the wallets
Creating an order debits the fake wallets in one step. The Stamp Duty Wallet pays the duty total. The Service Fee Wallet pays the service charges before GST, the same split as production, because GST on the service fee is collected when the wallet is topped up. If either balance is short, the create answers 402 with the usual envelope, the code PAYMENT_REQUIRED and a message that names the short wallet, such as The Stamp Duty Wallet balance is too low for this order, and a wallet field with STAMP_DUTY or SERVICE_FEE. Production answers the same way. Nothing is created and nothing stays debited. Top up and send the same request again.
An order that ends PAYMENT_FAILED, ISSUANCE_FAILED, CANCELLED or EXPIRED credits both amounts back, once, as a REFUND row, so your reconciliation job sees a debit and its refund for every failed order. An order that reaches ISSUED keeps its debit. Two orders sent at the same moment cannot both spend the same balance.
Why this still is not a complete rehearsal
The sandbox shows you the shape and the arithmetic of the money loop. It cannot show you the real payment checkout, real GST invoices, how long a real top-up takes to appear, or a real price book. The fee schedule in sandbox is illustrative, so do not copy its figures into your own pricing. Test the Checkout sequence with the payment provider's own test tools, test your balance polling and reconciliation against recorded ledger fixtures, and rehearse the full path once in production with a low-value order and a small top-up before launch. Production needs an approved production access request. The sandbox versus production guide covers the switch.
Worked example: a Monday morning
A broker platform expects forty orders on a Monday after a weekend of listings. On Friday evening its balance job showed the Stamp Duty Wallet at a level that covers about one day of volume and the Service Fee Wallet comfortably above its floor.
At eight in the morning, the job pages the finance on-call: the Stamp Duty Wallet is below one day of the expected peak. The on-call approves a top-up. The platform's server calls the top-up route with a baseAmount, gets razorpayOrderId and razorpayKeyId, and the finance user pays through Checkout. The server polls the wallet and sees the credit within a minute. The alert clears.
At ten, an order creation returns a 402 whose message names the Service Fee Wallet. The worker does not retry blindly. The wallet has dipped below the fees for the order, because Friday's top-up had assumed a lower average. The worker pauses new submissions, raises a top-up request for the Service Fee Wallet, and, when the credit shows in the ledger, resumes with the same idempotency key. No order was created by the failed attempt, and the retry succeeds. The ledger shows one duty debit and one fee debit for the order, each with the order reference.
In the afternoon, a customer cancels an order that is still in review. The platform cancels it before placement. The ledger shows refund entries for the duty and the fee. The platform tells the customer the request was cancelled and that the amount will be returned according to its own refund policy.
Testing
| Test | What it proves |
|---|---|
A top-up response is parsed into razorpayOrderId, razorpayKeyId and totalCharged | You can open Checkout |
| The balance is not credited from the browser callback | You trust the server-side wallet |
| Polling the wallet detects a credit within the timeout and flags a miss | You handle late and missing credits |
| A 402 on creation pauses submissions and raises a top-up for the wallet the message names, not a blind retry | Shortfalls are handled as shortfalls |
| Retrying after a refill uses the same idempotency key | You do not create duplicates |
| The nightly ledger sum equals the balance | Reconciliation works |
| Duty and fee debits for each order match its reference | You can explain every order |
| A timed-out top-up call is resolved from the ledger | You never create a second Razorpay order by reflex |
Common mistakes
- Treating payment as issuance. A debit is not a stamp.
- Crediting from the browser callback. The wallet is credited by the confirmation, so read the balance.
- Mixing the three balances. API fee, fees and duty are separate ledgers.
- Retrying a top-up on timeout. Read the ledger first, since a second call makes a second Razorpay order.
- Sizing from averages. Peak days decide refusals.
- Retrying a 402 on creation without topping up. Top up the wallet the message names, then retry with the same key.
- Expecting GST on duty. Duty is untaxed and has no invoice.
- Using payment intents for stamping. The e-Stamp routes fund themselves from the wallets.
- Promising refund timing to customers. Credits follow the platform's process, and your promise is your own.
Where this fits in the flow
Payment is step seven of eight. Before it come the catalogue, the schema, the state, instrument and article lookup, the duty and value calculation, the parties and the order. After it comes the order status and document access. The overview guide shows all eight with a rental example, and the e-Stamp API reference lists the routes in tabular form.
StampMitra is a private LegalTech platform operated by Bani Global Industries LLP. It is not a government body or a law firm, and nothing here is legal, tax or accounting advice. Confirm your own obligations with qualified professionals.
Sources
- StampMitra e-Stamp API reference, payment, checked 2026-10-29.
- StampMitra authentication reference for keys, scopes and the error envelope, checked 2026-10-29.
- StampMitra Verification, e-Stamp and e-Sign Service Terms, sections 11 to 14, checked 2026-10-29.
- StampMitra pricing and billing rules, and the billing and API credits refund policy, checked 2026-10-29.
Frequently asked questions
How is an e-stamp order paid for through the API?
At order creation, before any record is written, the platform debits the statutory duty from your Stamp Duty Wallet and the service fee, net of GST, from your Service Fee Wallet. Both are prepaid balances you fund with top-ups.
Is GST charged on stamp duty?
No. The Stamp Duty Wallet never adds GST, because duty passes through at cost. GST at 18 percent applies to StampMitra's own charges: it is added when you top up the Service Fee Wallet and invoiced for the API credit wallet.
How do I top up the Stamp Duty Wallet?
POST /v1/stamp-duty-wallet/topup with a positive baseAmount returns razorpayOrderId and razorpayKeyId. Open Razorpay Checkout with them, then read the wallet balance on your server until the credit appears, rather than trusting the browser callback.
Why does the Service Fee Wallet top-up show a GST amount?
GST is added on top of baseAmount at top-up, so totalCharged is base plus GST. The wallet is credited with the base, and orders later debit fees net of GST. Invoices therefore attach to top-ups and are listed at GET /v1/service-fee-wallet/invoices.
What happens if a wallet is short when I create an order?
The order is refused before anything is written and nothing is debited. The answer is a 402 PAYMENT_REQUIRED whose message names the wallet that is short, so top up that wallet and retry with the same Idempotency-Key.
Does paying mean the stamp is issued?
No. A debit is followed by human review, placement with the issuing side, generation and verification. Do not show a stamp as issued until the order and stamp statuses and a certificate say so.
What is the difference between the three balances?
The API credit wallet pays StampMitra's per-call API fee. The Service Fee Wallet pays procurement and convenience fees on orders. The Stamp Duty Wallet pays the statutory duty. They are separate ledgers and are never combined.
What are payment intents for?
POST /v1/payments/intents is the platform's generic Razorpay-backed payment resource tied to the generic order resource. E-Stamp orders fund themselves from the wallets instead, so keep intents separate from your stamping flow unless support advises otherwise.
How do I know a top-up has been credited?
Read GET /v1/stamp-duty-wallet or the service fee equivalent, or walk the transactions ledger, until a TOPUP entry with your razorpayOrderId appears. The credit comes from Razorpay's confirmation to StampMitra, not from your browser.
Can I retry a top-up call that timed out?
Read the ledger first. Each call creates a new Razorpay order and each can be paid, so a reflex retry can produce two payments. Create your own pending top-up record, reuse an open one, and reconcile pending records daily.
How much should I keep in each wallet?
Size from peak days, not averages: lead time in days times peak daily need times a margin such as 1.5, tracked separately for duty and fees. Alert in tiers and make top-up approval quick, since a refusal on your busiest day is the costly one.
Where do I get GST invoices?
API credit wallet invoices are on the dashboard billing page. Service Fee Wallet top-up invoices come from GET /v1/service-fee-wallet/invoices. The Stamp Duty Wallet has none because duty carries no GST. Ask your accountant how to treat them in your books.