The advance is collected with Razorpay Checkout. Every payment is checked on your server before an order is confirmed: the signature, then the payment itself is fetched from Razorpay and must match the order, the amount and the currency.
API keys
If Razorpay for WooCommerce is installed and has keys, leave Use the keys from Razorpay for WooCommerce switched on in Payments. Otherwise switch it off and enter your Key ID and Key secret from Razorpay Dashboard, Account and Settings, API Keys.
The Status row in Settings shows which key will be used. Without keys, no advance or COD charges are taken, and a red notice at the top of COD Protection says so. The blocklist and the returns network still hide COD from refused buyers.
Webhook (strongly recommended)
Some buyers pay and close the tab before returning to your store. The webhook confirms those orders on its own.
- In Razorpay Dashboard open Account and Settings, Webhooks, Add New Webhook.
- Webhook URL: copy it from COD Protection Settings. It looks like
https://yourstore.in/wp-json/codp/v1/razorpay-webhook - Secret: choose a long random value and keep a copy.
- Active events:
payment.capturedandpayment.authorized. - Save, then paste the same secret into Webhook secret in COD Protection Settings and save.
The webhook is separate from the one used by Razorpay for WooCommerce and does not interfere with it. Advance payments carry their own note, so the Razorpay plugin never mistakes an advance for a full payment.
Test mode
To try the full flow without real money, use Razorpay test keys (they start with rzp_test_) and a test webhook, place an order, and pay with a Razorpay test card or UPI id. Switch back to live keys before real buyers check out.
Security notes
- The advance amount always comes from the order saved on your server.
- A payment for a different amount, currency or Razorpay order is refused and noted on the order.
- If the webhook and the browser confirm the same payment at once, the order is confirmed only once.
- Key secret and webhook secret fields are never shown again after saving; leave them empty to keep the saved value.