Skip to content

Razorpay

Razorpay's package integration creates an Order on the server and returns the public key and order details for the Razorpay Checkout client. The driver also implements shared subscriptions, payouts, and payment links.

Setup

RAZORPAY_KEY_ID=rzp_test_...
RAZORPAY_KEY_SECRET=your_key_secret
RAZORPAY_ACCOUNT_NUMBER=your_account_number
RAZORPAY_CURRENCY=INR
RAZORPAY_BASE_URL=https://api.razorpay.com/v1
RAZORPAY_CALLBACK_URL=https://example.com/payment/callback
RAZORPAY_WEBHOOK_SECRET=your_webhook_secret

Use test/live key pairs and the corresponding environment. The driver authenticates with HTTP Basic Auth; never expose RAZORPAY_KEY_SECRET.

Create an order and open Checkout

use Alphabalex\PaymentMadeEasy\Facades\Payment;

$order = Payment::driver('razorpay')->initializePayment([
    'amount'       => 499.00,
    'currency'     => 'INR',
    'email'        => 'customer@example.com',
    'name'         => 'Jane Doe',
    'reference'    => 'ORDER_123',
    'callback_url' => 'https://example.com/payment/callback',
]);

// Pass order ID, key_id, customer fields, and callback to Razorpay Checkout.js.
// Verify the returned payment/order with the server-side API before fulfilment.

The package accepts amounts in major units and converts to paise (₹1 = 100 paise). verifyPayment() expects an Order ID, while getPayment() and refundPayment() operate on a Payment ID.

Additional capabilities

The driver implements shared subscription, disbursement, and payment-link interfaces. Subscription plans are provider plans and require an eligible Razorpay account; payouts require the account number and payout feature access. Check capability detection before calling optional features.

Webhooks

Set the webhook signing secret and register POST /webhooks/payment-gateways/razorpay. Keep signature checks enabled and reconcile the captured payment/order on the server. See webhook configuration.

See Razorpay in the API reference for payment link, subscription, and transfer examples.