Webhooks
Get notified the moment something happens — no polling. Every delivery is signed and retried.
Set your webhook URL and reveal your signing secret from the Webhooks page. We POST a JSON event to your URL and retry with backoff until you return a 2xx.
Events
| Field | Type | Description | |
|---|---|---|---|
| buy.completed | event | optional | A buy was fulfilled and the asset credited. payment_id names the payment order it came from, or is null. funding_source says who paid for a /partner/buy/confirm buy — "partner_wallet" or "user_inr_wallet" — and is null for every other buy. rate_inr_per_gram is the rate stored on the buy: GST included for a buy paid through a payment order, GST excluded for a /partner/buy/confirm buy (the quote's rate). |
| sell.completed | event | optional | A sell settled into the user's INR wallet. |
| sip.created | event | optional | A recurring plan (SIP) was created. status is "pending_authorisation": nothing is debited until sip.activated. See SIP events below. |
| sip.activated | event | optional | A SIP's mandate was approved, or its first payment was collected, whichever comes first. Sent once per SIP for every mandate provider, and again each time a paused SIP resumes. |
| sip.installment | event | optional | A SIP debit was collected and the metal credited. One per debit, with legs[] and the metal and grams at the top level. No per-gram rate (removed 25 Nov 2026). |
| sip.cancelled | event | optional | New in live. A SIP has ended and will not debit again: the customer revoked the mandate, the provider cancelled it, you cancelled it, or it was stopped in the app. Sent once per SIP, with reason and cancelled_at. |
| sip.mandate_failed | event | optional | A SIP was never approved and has been closed. status is "cancelled" and reason "not_authorised". |
| sip.withdrawn | event | optional | New. A SIP's metal and cashback sats moved to the customer's main wallet, where /partner/sell can sell them: a withdraw or stop through the API or the app, or the settlement of an ended SIP. trigger says which. See sip.withdrawn below. |
| withdrawal.pending | event | optional | An INR withdrawal was created and is queued for payout. |
| withdrawal.completed | event | optional | The money was sent to the user's bank account. Carries completed_at and, when known, utr. |
| withdrawal.failed | event | optional | The withdrawal could not be paid, or the bank sent it back. The full amount is back in the user's INR balance (refunded: true). |
| payment.completed | event | optional | A payment order was paid and the metal credited. See Collect payments. |
| payment.failed | event | optional | A payment order closed without a purchase. refund.status "pending" means the money arrived and is being refunded or retried. |
| payment.expired | event | optional | Nobody paid a payment order before it expired. |
| payment.refunded | event | optional | A refund_due payment order was refunded to the customer. |
| kyc.approved | event | optional | A user's KYC was approved — instantly (PAN + DigiLocker) or after our review. Also fires for kyc/submit and the embed's kyc. |
| kyc.under_review | event | optional | A user's KYC went to OroPocket's review. data.reason says why (see KYC events below). kyc.approved or kyc.rejected follows. |
| kyc.rejected | event | optional | A user's KYC was rejected. data.reason is the reviewer's message; the PAN and Aadhaar are released so the user can try again. |
| test.ping | event | optional | Sent when you use “Send test event” in the dashboard. |
Payload
Every delivery has the same envelope: event, event_id, created_at and data, nothing else. event_id is stable across retries — deduplicate on it. There is no top-level mode: sandbox deliveries carry "mode": "sandbox" inside data, and live deliveries carry no mode at all.
{
"event": "buy.completed",
"event_id": "evt_9f2c1a7b3d…",
"created_at": "2026-08-08T09:12:44.000Z",
"data": {
"user_code": "usr_xxx",
"transaction_id": "…",
"asset_type": "gold",
"amount_inr": 1000,
"quantity_grams": 0.094907,
"rate_inr_per_gram": 10204.08,
"status": "completed",
"source": "s2s",
"payment_id": null,
"funding_source": "partner_wallet"
}
}KYC events
kyc.* events go to the partner whose API drove the KYC and to the partner the user signed up through. In test mode, data also carries "mode": "sandbox". The full flow is in KYC.
{
"event": "kyc.approved",
"event_id": "evt_4b1e9c0a2f",
"created_at": "2026-10-17T10:04:12.000Z",
"data": {
"user_code": "usr_xxx",
"status": "approved"
}
}kyc.under_review reasons — informational; you don't need to act, just show the user that their KYC is being checked:
| reason | Why the KYC is in review |
|---|---|
| documents_review | The user sent a PAN photo or Aadhaar photos. A person checks them, usually within 24–48 h. |
| name_mismatch | The name on the PAN and on the Aadhaar don't match closely enough to approve automatically. |
| dob_unconfirmed | The date of birth couldn't be confirmed from both documents. |
| possible_duplicate | The identity may already belong to another OroPocket account. |
| identity_mismatch | The PAN and the Aadhaar may not belong to the same person. |
| manual_review | Anything else our team wants to look at. |
SIP events
sip.* events go to the partner the SIP was created through and to the partner the user signed up through. sip_id is the same whole number in every one of them, in GET /partner/payments/sips and in GET /partner/sips. For a SIP created through POST /partner/payments/sips, id is its ppo_… id. A SIP goes sip.created → sip.activated → one sip.installment per debit → sip.cancelled, or sip.created → sip.mandate_failed if it is never approved. What each status means is under SIP statuses. sip.withdrawn is the exception to who receives it: it goes only to the partner the SIP came through, since that is whose sellable balance the move credits.
{
"event": "sip.created",
"event_id": "evt_…",
"created_at": "2026-11-24T09:00:04.000Z",
"data": {
"user_code": "usr_xxx",
"sip_id": 16176,
"sip_name": "Wedding gold",
"asset_type": "gold",
"frequency": "monthly",
"installment_amount_inr": 500,
"status": "pending_authorisation"
}
}sip.created, sip.activated, sip.cancelled and sip.mandate_failed share sip_id, sip_name, asset_type ("gold", "silver", or "both" for a plan that buys both), frequency, installment_amount_inr and status. sip.activated is sent once when the SIP first comes alive, for every mandate provider, and again each time a paused SIP resumes, so treat it as "this SIP will debit again" rather than as a one-off. It is usually sent before the first sip.installment, but don't rely on the order: with some mandate providers the first debit's sip.installment is sent first, and a retried delivery can arrive late.
sip.installment fields
| Field | Type | Description |
|---|---|---|
| user_code | string | The customer. |
| sip_id | number | The SIP. |
| installment_ref | string | This debit's reference. Unique per debit; use it to de-duplicate instalments. |
| amount_inr | number | What the customer's bank debited. |
| funded_amount_inr | number | What went to the purchase: amount_inr − fee_inr. GST-inclusive — the platform fee and the 3% GST come out of it, and the rest is metal. |
| fee_inr | number | Gateway fee taken from this debit. 0 unless the SIP was created through POST /partner/payments/sips with the customer bearing the fee. |
| legs[] | array | One entry per metal bought: asset_type, amount_inr (that metal's share of funded_amount_inr), quantity_grams and transaction_id. A plan that buys both metals has two. |
| status | string | "completed". |
| id | string | null | New. The ppo_… id when the SIP was created through POST /partner/payments/sips, else null. |
| asset_type | string | New. "gold" or "silver" for one leg, "both" for two. |
| quantity_grams | number | New. Grams credited by this debit: the sum of the legs. |
| transaction_id | string | null | New. The leg's transaction_id when there is one leg; null for two. |
| installment_number | number | null | New. Which debit of the plan this is, 1 being the first, counted per metal for a plan that buys both. The same number as sip.installment_number on /partner/transactions/all. null if it could not be read. |
| sip_status | string | null | New. The SIP's status after this debit, normally "active". null if it could not be read. |
legs[].rate_inr_per_gram and the top-level rate_inr_per_gram. SIP data no longer carries a per-gram rate. Use quantity_grams and the amounts, or the instalment's invoice (GET /partner/transactions/:transaction_id/invoice with a leg's transaction_id), which shows the price per gram. Deliveries stored before the change and replayed later keep the fields.sip.cancelled reasons
Sent once per SIP when it stops after its mandate was approved, and also when a SIP created through POST /partner/payments/sips is stopped on purpose (by you, or in the app) before it was approved. A SIP that simply never gets approved gets sip.mandate_failed instead. Gold and silver already bought stay with the customer. For a SIP created through the payments API, id and reference are included.
| reason | Who or what stopped it |
|---|---|
| customer_cancelled | The mandate provider reported that the customer revoked the mandate in their UPI app or bank. |
| partner_cancelled | You called POST /partner/payments/sips/:id/cancel. |
| stopped | It was stopped in the OroPocket app or the embed, or by OroPocket. |
| mandate_cancelled | The mandate provider reported the mandate cancelled without saying who cancelled it. Most providers report a customer revoking the mandate this way, so don't read it as "not the customer". |
| mandate_expired | The mandate expired. |
In sandbox, POST /partner/payments/sips/:id/simulate sends sip.activated, sip.installment, sip.cancelled and sip.mandate_failed (see Collect payments → Sandbox), each with "mode": "sandbox" in data. sip.installment has the live fields above, with no per-gram rate, as in live. The other three carry the sandbox SIP object (id, sip_id, status, name, fee, …) with the live fields added, and a simulated failure's sip.mandate_failed has status "failed". POST /partner/sips/:sip_id/stop on a sandbox SIP sends sip.cancelled with reason partner_cancelled. Sandbox does not send sip.created or sip.withdrawn: sandbox SIP debits are credited straight to the test user's sellable balance, so nothing ever moves out of a SIP wallet.
sip.withdrawn fields
Sent after a SIP's holdings move to the customer's main wallet, where /partner/sell can sell them: once per move, to the partner the SIP came through only. That covers POST /partner/sips/:sip_id/withdraw and /stop, POST /partner/payments/sips/:id/cancel, a withdraw or stop by the customer in the app, and the settlement of a SIP that ended another way (for example, the customer revoked the mandate). It is not sent when nothing moved.
| Field | Type | Description |
|---|---|---|
| user_code | string | The customer. |
| sip_id | number | The SIP. |
| id | string | null | The ppo_… id when the SIP was created through POST /partner/payments/sips, else null, as on the other sip.* events. |
| withdrawn[] | array | One entry per metal moved: asset_type, quantity_grams, value_inr (the grams at our sell rate at the moment of the move; nothing is sold) and transaction_id (the move's reference). Empty when only cashback sats moved. |
| cashback_sats_withdrawn | number | Bitcoin cashback sats moved, as a count. |
| total_value_inr | number | The sum of withdrawn[].value_inr. Sats are not included. |
| trigger | string | "withdraw" (a withdraw through the API or the app, including one that settled an ended SIP), "stop" (a stop or cancel through the API, or a stop in the app) or "settle" (an ended SIP settled by OroPocket). |
| sip_status | string | null | The SIP's status after the move: "active" after a withdraw on a running SIP, "cancelled" after a stop. null if it could not be read. |
There is no per-gram rate. Milestone sats that are forfeited are not in the event; the stop response and GET /partner/sips/:sip_id/stop-preview give them.
Withdrawal events
withdrawal.* events go to the partner that placed the withdrawal and to the partner the user signed up through. withdrawal_id is the id POST …/withdrawals gave (also its transaction_id) and the id on each GET …/withdrawals row. See Bank accounts & withdrawals.
| Field | Type | Description |
|---|---|---|
| user_code | string | The customer. |
| withdrawal_id | string | INR_WD_… in live, wd_test_… in sandbox. Treat it as opaque: live ids made from 25 Nov 2026 are INR_WD_ + a base-36 time + _ + 16 hex characters, and older ones keep their earlier form. |
| status | string | "pending", "completed" or "failed", matching the event. |
| amount_inr · fee_inr · net_amount_inr | number | Gross amount, payout fee, and what reaches the bank. |
| created_at | string | When the withdrawal was created. |
| completed_at · utr | string | withdrawal.completed only. utr, the bank reference, is present when known. |
| failed_at · failure_reason · refunded | string · string | null · true | withdrawal.failed only. The amount is back in the user's INR balance. |
| reversed | true | withdrawal.failed only, when a payout that had completed was sent back by the bank. |
{
"event": "withdrawal.completed",
"event_id": "evt_…",
"created_at": "2026-11-24T10:02:41.000Z",
"data": {
"user_code": "usr_xxx",
"withdrawal_id": "INR_WD_…",
"status": "completed",
"amount_inr": 2500,
"fee_inr": 0,
"net_amount_inr": 2500,
"created_at": "2026-11-24T08:15:02.000Z",
"completed_at": "2026-11-24T10:02:40.000Z",
"utr": "…"
}
}Headers
| Field | Type | Description | |
|---|---|---|---|
| X-OroPocket-Signature | string | optional | sha256=<hex HMAC>. See below — signed over `{timestamp}.{rawBody}`, NOT the body alone. |
| X-OroPocket-Timestamp | string | optional | Unix seconds. Part of the signed payload; reject old timestamps to stop replays. |
| X-OroPocket-Event | string | optional | The event name, e.g. buy.completed. |
| X-OroPocket-Event-Id | string | optional | Same value as event_id in the body — use it to dedupe. |
If your receiver authenticates us with its own credential (e.g. x-access-key), add it under Webhooks in your dashboard — up to 10 static headers, attached to every delivery including retries. One set covers both sandbox and live. OroPocket-set headers can never be overridden.
Verify the signature
`${timestamp}.${rawBody}` — the timestamp, a literal dot, then the raw request body. Hashing the body on its own will fail every time. Use the raw bytes, before any JSON parsing or re-serialisation.import crypto from "crypto";
// rawBody must be the raw string/Buffer, e.g. express.raw({type:"application/json"})
function verify(rawBody, headers, secret) {
const signature = headers["x-oropocket-signature"] || "";
const timestamp = headers["x-oropocket-timestamp"] || "";
// Reject replays: ignore anything older than 5 minutes.
const age = Math.abs(Date.now() / 1000 - Number(timestamp));
if (!timestamp || age > 300) return false;
const expected =
"sha256=" +
crypto
.createHmac("sha256", secret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(signature);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Retries
We make one immediate attempt with a 10 second timeout, then retry failures up to 5 attempts total. Any 2xx acknowledges the delivery; non-2xx responses and timeouts are retried on this backoff:
| Field | Type | Description | |
|---|---|---|---|
| After attempt 1 | 30 seconds | optional | First retry. |
| After attempt 2 | 2 minutes | optional | |
| After attempt 3 | 10 minutes | optional | |
| After attempt 4 | 60 minutes | optional | |
| After attempt 5 | 6 hours | optional | Final attempt; then the delivery is marked failed. |
The retry queue lives in the database, so retries survive restarts. Return a 2xx as soon as you've persisted the event and do slow work asynchronously — otherwise the 10s timeout will cause duplicate deliveries.