Official Python SDK for Razorpay — India's leading payment gateway. Current version: 2.0.1 (Mar 2026). Auth uses API key + secret tuple. All amounts in paise (1 INR = 100 paise) — not rupees. Payment flow: create order server-side → collect payment client-side → verify signature server-side. Signature verification is mandatory — skipping it is a security vulnerability. Test keys start with 'rzp_test_', live keys with 'rzp_live_'.
pip install razorpayVerified import paths — ran on the pinned version, not inferred.
Razorpay Python SDK — order creation, signature verification, and refund.
amount_in_paise = amount_in_inr * 100. Always multiply INR by 100.
Always call client.utility.verify_payment_signature(params) with razorpay_order_id, razorpay_payment_id, razorpay_signature.
Use environment variables: RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET. Verify key starts with 'rzp_test_' in development.
client.utility.verify_webhook_signature(payload, signature, WEBHOOK_SECRET) — get WEBHOOK_SECRET from Razorpay dashboard under Webhooks settings.
Add 'payment_capture': 1 to order creation for automatic capture.
client.payment.fetch(), client.order.create(), client.refund.fetch(), client.customer.create()
Use currency='INR' for standard integration. Contact Razorpay for international payment activation.
Ensure that RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET are correctly obtained from your Razorpay dashboard and properly configured in your application (e.g., via environment variables or direct instantiation of razorpay.Client).
Ensure RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET environment variables are set correctly with valid API keys. Double-check for typos and confirm the keys are active and have the necessary permissions in your Razorpay dashboard.