Socioverse

Loading…

Paid but No Download: Why Digital Product Delivery Fails After a Razorpay Payment

By Anshul Rastogi on 2026-12-01

The message every creator selling files eventually gets

"I paid. Where is my download?"

It arrives in your DMs with a screenshot of a UPI success screen. The money left the buyer's account. Your dashboard shows no sale, or a sale stuck on "pending", and no email went out. Now you are doing support by hand, the buyer thinks you are a scam, and you have no idea whether this happened once or to every tenth customer.

Most guides on selling digital products from Instagram stop at "connect a payment gateway and upload your file". They treat delivery as something that simply happens after a payment succeeds. It does not simply happen. A payment succeeding and your store finding out that it succeeded are two different events, and the gap between them is where paid orders go missing.

This post walks through where that gap is, using Razorpay's own documentation, and the exact design we use in Planets, the Socioverse storefront, to close it. Every Razorpay quote below is from Razorpay's documentation, linked in Sources, accessed 22 November 2026.

First Principle: your store is told about a payment, it does not see it

When a buyer pays, the money moves between the buyer's bank, Razorpay and the creator. Your store is not in that path. It learns the outcome from messengers, and there are exactly two of them:

  1. The browser. When checkout finishes, Razorpay hands the result to a JavaScript handler on your checkout page, which tells your server.
  2. The webhook. Separately, Razorpay's servers send an event such as payment.captured to a URL on your server.

Razorpay's own guidance is to use both: "use the handler function for immediate client-side confirmation and webhooks for server-side verification." Each messenger fails in its own way, and a store that trusts only one of them inherits that failure.

Three ways a store learns about a Razorpay payment: the browser handler, the payment.captured webhook and a sweeper that asks Razorpay directly; all three call one fulfillment function that delivers once

Failure 1: the browser never comes back

The handler only runs if the checkout page is still alive when the payment completes. Razorpay names the reasons it might not be: "a slow network connection or your customer closing the window while processing the payment." On a phone, paying with UPI means leaving the browser for a UPI app and coming back. If the tab does not come back alive, the handler never fires, the store never hears about the payment, and the order sits on "pending" with the buyer's money already gone.

A store that delivers only from the browser handler loses exactly these orders, and the buyers it loses are the ones who did everything right.

Razorpay is also explicit that the browser's word is not proof on its own: "You must verify the signature on your server before fulfilling the order." The signature is an HMAC SHA256 of the order id and payment id, keyed with your secret, which never leaves your server:

generated_signature = hmac_sha256(order_id + "|" + razorpay_payment_id, secret)

A store that marks an order paid because the page said so, without that check, can be talked into delivering for free by anyone who can edit a request.

Failure 2: the webhook is late, repeated and out of order

The webhook does not depend on the buyer's tab, which is why it exists. But Razorpay documents three properties of it that most simple integrations ignore.

What Razorpay says What it means for delivery
"Razorpay follows at-least-once delivery semantics" and "your endpoint might receive the same webhook event multiple times. This is an expected behaviour" One payment can arrive two or three times. Without deduplication, that is two or three receipts, or two course enrollments for one purchase.
"you may not always receive" webhooks in the order events occur Your handler cannot assume payment.authorized arrives before payment.captured, or that a failure event is older than a success.
A server that "fails to respond in 5 seconds" is marked timed out, and "it is assumed that the webhook was not processed and is sent again" A slow handler that did deliver gets the same event again, and will deliver again unless it checks.
Failed events are retried "in exponential backoff policy for 24 hours", then "the webhook is disabled" A store that is down or misconfigured for a day stops receiving payment events at all until someone re-enables the webhook in the dashboard.

So the webhook fixes the browser's failure and adds new ones. Two messengers, each unreliable in a different way, both shouting "paid" at your server for the same order, possibly at the same moment.

Failure 3: the payment is real but not finished

There is a third state between "failed" and "paid". Razorpay separates an authorized payment from a captured one. By default capture is automatic, but Razorpay is clear about what happens if an authorized payment is never captured: "payments that are not captured within this period will be refunded automatically to customers", with the period set at 3 days from creation.

A store that treats "authorized" as paid can deliver a product for a payment that is later refunded on its own. A store that treats "authorized" as failed tells a buyer their payment failed while the money is held, and the buyer pays a second time.

How Planets delivers: three paths, one locked door

The design rule is simple to state. Any path may notice a payment. Only one function may act on it, and acting twice must do nothing.

Path 1: the browser, verified on the server

When the Planets checkout handler fires, it calls a server function with Razorpay's three values. That function does four things before anything is delivered:

Path 2: the webhook, deduplicated

The payment.captured webhook verifies Razorpay's signature on the raw request body, then claims the event by its x-razorpay-event-id, the header Razorpay documents as "unique per event", before doing any work. A repeated delivery of the same event finds it already claimed. It runs the same amount, currency and status check as Path 1 and calls the same fulfillment function.

Two details matter here. A payment.failed event only marks an order failed if the order is still pending, so a late failure event for an earlier attempt can never overwrite a payment that succeeded on a retry. And if a database write fails, the handler returns an error on purpose, so Razorpay's own retry runs the branch again instead of the failure being swallowed.

Path 3: the sweeper, which asks Razorpay directly

The first two paths both wait to be told. The third goes and asks. Every 10 minutes a scheduled job picks up Razorpay orders older than 20 minutes that are still pending or failed, or marked paid but not delivered, and reads that order's payments straight from Razorpay's API.

Each order is checked again in 6 hours, or in 1 hour if the last check hit an error. This is the path that rescues the buyer whose tab died and whose webhook was lost during a day the endpoint was down: no message from anyone is needed, because the store goes and looks.

What the sweeper does with what Razorpay reports: one matching captured payment is delivered, an authorized payment waits, a full refund revokes access, and two captured payments or a partial refund go to a human

The locked door: one fulfillment function

All three paths end in the same database function, and that function is where duplicates die:

Delivery and the receipt email are recorded separately. If delivery succeeded but the email did not go out, the next path that arrives finds the product delivered and the receipt missing, and sends the receipt rather than stopping.

What the fulfillment function does: lock the order row, return already fulfilled if delivered, refuse refunded orders or a different payment id, then mark paid and create access in one transaction, then send the receipt

The download link is part of delivery too

Getting the order marked paid is half the job. The other half is a link that works for the buyer and only for the buyer. A Planets download link proves which order it belongs to, the signed-in session proves who is asking, and the file is served through a short-lived signed URL rather than a permanent public one. A creator can set a per-order download limit, or switch downloads off and allow viewing only, in which case the file is streamed through our server and no grabbable link is ever handed out.

What to check in whatever you sell with

You do not need to use Planets to use this. If you sell files through any storefront on Razorpay, these five questions tell you how your orders behave on a bad day:

Question Good answer
If the buyer closes the tab right after paying, are they still delivered? Yes, from the webhook or a reconciliation job
Is the payment signature checked on the server before delivery? Always
What happens when the same webhook arrives three times? One delivery, one receipt
What does the buyer see when a payment is authorized but not captured? "Do not pay again", not "payment failed"
If the webhook is down for a day, who finds the orders paid during it? A job that asks Razorpay directly, without waiting to be told

If your current tool cannot answer the last one, the orders paid during an outage are found the way you found the first one: a buyer in your DMs with a screenshot.

Planets is part of Socioverse, alongside DM automation, the content calendar and research. See the plans, or Try for ₹99 for 7 days.

Sources

More from the blog

Related