Emberstore logoEmberstore
Payment gateways

Razorpay

Set up Razorpay for UPI, cards and wallets in INR, with refunds, disputes and subscriptions.

Razorpay is the usual choice for players in India: UPI, Indian cards, netbanking and wallets. It bills in INR by default, so it is also the easiest way to see how Emberstore converts prices (see Prices and currencies). One-off items use Razorpay Payment Links, recurring items use Razorpay Subscriptions.

Gateway idrazorpay
Refund by APIYes
RecurringYes, for durations of whole days, at least 7 days
Status lookupYes
DisputesYes
WebhookYou add it in the Razorpay dashboard, on port 80 or 443 only
Billing currencyinr in the shipped config
Minimum charge₹1.00 (100 paise)

Setup

Get your keys

In the Razorpay dashboard, create an API key pair and copy the key id and key secret. Test keys start with rzp_test_, live keys with rzp_live_. Test mode allows only 30 Payment Links.

Add the webhook

In the Razorpay dashboard (Account & Settings, Webhooks), add <webhook.public-base-url>/webhook/razorpay with a secret of your choice, and tick:

payment_link.paid, payment_link.partially_paid, payment_link.expired, payment_link.cancelled, payment.authorized, subscription.activated, subscription.charged, subscription.cancelled, subscription.completed, subscription.halted, refund.processed, payment.dispute.created, payment.dispute.lost

Fill in config.yml

razorpay:
  enabled: true
  icon: AMETHYST_SHARD
  # Currency this gateway bills in, empty uses price-currency
  currency: "inr"
  # Key id from your Razorpay dashboard. Use a test key while testing
  key-id: "rzp_test_..."
  # Key secret from your Razorpay dashboard
  key-secret: "..."
  # Secret of the webhook registered for this plugin
  webhook-secret: "..."

Run /store admin reload.

Good to know

  • Ports 80 and 443 only. Razorpay will not deliver webhooks to port 8443, so a reverse proxy in front of the listener is required. See the Web dashboard guide.
  • Prices in rupees. Give an item prices: inr: 399 to charge exactly ₹399, or leave it out and the USD price is converted. Both are shown on Prices and currencies.
  • Other currencies need International Payments turned on in Razorpay. UPI only works in INR.
  • Link lifetime. Razorpay links last at least 16 minutes, even if checkout.expire-minutes is lower.
  • A failed UPI attempt does not close the order, because the buyer can try again on the same link. The order ends when the link expires.
  • Subscriptions need the Subscriptions feature turned on in your Razorpay account. They bill every n weeks for whole weeks, otherwise every n days. Cancelling lets the paid cycle run out first. Razorpay emails the buyer about failed charges. A restart can create a second plan for the same price, because plans cannot be deleted at Razorpay.
  • Partial refunds made in the dashboard are ignored.
  • Refunds come out of your Razorpay balance. If the balance is lower than the refund, Razorpay refuses it with a vague "invalid request sent". Emberstore adds a note saying so. Wait for more payments to settle or add funds, then run the refund again. Nothing changes on the order until the refund goes through.

On this page