Razorpay Adapter

Adds Razorpay as a payment method to Payload's ecommerce plugin, handling order creation, payment capture verification, and transaction recording.

Community 0 v1.0.1

Installation

pnpm add @codenik/payload-razorpay

About

This adapter plugs Razorpay into the official Payload Ecommerce plugin as a payment method. It implements the `PaymentAdapter` contract that `@payloadcms/plugin-ecommerce` expects, so you register it inside `ecommercePlugin({ payments: { paymentMethods: [razorpayAdapter({...})] } })` next to any other providers. `initiatePayment` calls Razorpay's Orders API to create an order, stores the order id and a flattened cart snapshot inside a Payload transaction, and returns the id to the frontend. After the customer finishes Razorpay Checkout, `confirmOrder` fetches the payment through the Razorpay SDK, checks that the status is `captured`, then creates the Payload order, marks the cart as purchased, and updates the transaction to `succeeded`. A webhook endpoint is registered at `POST /webhooks`, though the handler is a stub that returns `200` and does not verify Razorpay signatures server-side, so webhook-driven reconciliation is not wired up. You pass `publishableKey` and `secretKey` to the server adapter and `publishableKey` to the `razorpayAdapterClient` frontend helper. The README pairs this package with the third-party `react-razorpay` library for opening the checkout modal in the browser, since the adapter itself only owns the backend lifecycle. It targets Payload 3.x with `@payloadcms/plugin-ecommerce` as a peer dependency and ships ESM TypeScript output for Node.js 20+ and Next.js 15+.

Package info

Package name
@codenik/payload-razorpay
Latest version
1.0.1
Unpacked size
35 kB
Last publish
Jul 27, 2026

Similar plugins

More in Commerce