VERDOCK

Razorpay adapter

The same decide, send once, read back and sign flow for Razorpay payouts in INR, in test mode and with the standard library only.

On this page

verdock.adapters.razorpay.RazorpayAdapter follows the flow described in the Stripe adapter: decide before any request, reserve against the caps, send once with an idempotency header, read the record back and sign the outcome. This page covers what differs for Razorpay.

Configure keys#

ProviderEnvironment variables
RazorpayRAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET, and for payouts RAZORPAY_X_ACCOUNT_NUMBER

Live keys (rzp_live_) are refused unless you pass allow_live=True or set VERDOCK_ALLOW_LIVE=1. Razorpay accepts INR only.

Send a payout#

from verdock.adapters import load_env
from verdock.adapters.razorpay import RazorpayAdapter

load_env(".env")
razorpay = RazorpayAdapter()
result = razorpay.payout(amount_minor=250000, currency="INR", counterparty="cust_9",
                         request_key="order-78-payout", fund_account_id="fa_123")
print(result.state)

250000 is INR 2,500.00. Constructors are RazorpayAdapter(key_id, key_secret, account_number=..., base_url=..., policy_path=..., state_dir=...) in Python and new RazorpayAdapter(keyId, keySecret, options) in Node. Keys left out come from the environment.

Request id and read back#

Razorpay payout
CreatePOST /v1/payouts
IdempotencyX-Payout-Idempotency header
Request id in the recordreference_id and notes.verdock_request_id
Read backGET /v1/payouts/{id}
Find without the idList payouts for the account number, match reference_id

Status mapping#

Razorpay statusState
Payout processedVERIFIED if the record matches
Payout queued, pending, scheduled, processingPENDING
failed, rejected, cancelled, reversedMISMATCH

Lost responses, reconcile(request_key) and retry_same_key(request_key) behave as described for Stripe. A Node call returns a promise. A refusal rejects with Refused and a provider 4xx answer rejects with ProviderError. The result has state, ok, replayed, providerId, detail, operation, requestKey, requestId, amountMinor and currency.