Paid but No Download: Why Digital Product Delivery Fails After a Razorpay Payment
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:
- The browser. When checkout finishes, Razorpay hands the result to a JavaScript handler on your checkout page, which tells your server.
- The webhook. Separately, Razorpay's servers send an event such as
payment.capturedto 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.

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:
- Checks the signature with the formula above, using the key secret held on the server.
- Finds our own order for that Razorpay order id. No order, no delivery.
- Asks Razorpay for the payment itself and checks that the payment id, order id, amount and currency all match our order, and that the status is
captured. - Answers honestly when it is not finished. If the payment is authorized but not yet captured, the buyer sees "Payment is awaiting confirmation. Do not pay again. Check your purchases shortly." If the amount or order does not match, they see "Payment details do not match this order. Contact support." It never says "failed" for a payment that may still complete.
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.
- One captured payment that matches the order: deliver it through the same function.
- An authorized payment: record it as awaiting capture, deliver nothing yet.
- A full refund: revoke access.
- More than one captured payment, or a partial refund: stop and flag the order for a human. Access is kept on a partial refund, because guessing is worse than asking.
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.

The locked door: one fulfillment function
All three paths end in the same database function, and that function is where duplicates die:
- It locks the order row (
SELECT ... FOR UPDATE), so two paths arriving in the same second run one after the other, never side by side. - If the order is already delivered, it returns "already fulfilled" and does nothing. The second, third and fourth "paid" messages are harmless.
- If the order was refunded, it refuses. If a different payment id is already attached to the order, it refuses.
- Otherwise it marks the order paid and creates the course enrollment, booking or access record in the same transaction. A payment is never recorded without its delivery, and a delivery is never created without its payment.
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.

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
- Razorpay, Webhooks: https://razorpay.com/docs/webhooks/ (handler for client-side confirmation, webhooks for server-side verification; late authorised payments). Accessed 22 November 2026.
- Razorpay, Webhook Best Practices: https://razorpay.com/docs/webhooks/best-practices/ (at-least-once delivery,
x-razorpay-event-id, ordering, 5-second timeout, 24-hour retry and disable). Accessed 22 November 2026. - Razorpay, Validate and Test Webhooks: https://razorpay.com/docs/webhooks/validate-test/ (idempotency, delivery order). Accessed 22 November 2026.
- Razorpay, Standard Checkout Integration Steps: https://razorpay.com/docs/payments/payment-gateway/web-integration/standard/integration-steps/ (server-side signature verification formula). Accessed 22 November 2026.
- Razorpay, Payment Capture Settings: https://razorpay.com/docs/payments/payments/capture-settings/ (auto-capture default, 3-day capture window, automatic refund of uncaptured payments). Accessed 22 November 2026.