Adds Razorpay as a payment method for the Payload Ecommerce plugin. It creates Razorpay orders on the server, verifies payment signatures when an order is confirmed, and records transactions. Requires a Razorpay account, the Payload Ecommerce plugin and your own frontend checkout UI.
Razorpay adapter for Payload Ecommerce
Installation
npm i @codenik/payload-razorpay0
Stars
0
Forks
0
Open Issues
2 months ago
Last Updated
4
Weekly Downloads
v1.0.2
npm Version
34.6 KB
Unpacked Size
2
Dependencies
Trends appear after 7 days of data. Collecting since Oct 22 — 5 daily snapshots so far.
Trends appear after 7 days of data. Collecting since Oct 22 — 5 daily snapshots so far.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1314210045-root)<a href="https://payloaddirectory.dev/plugins/1314210045-root"><img src="https://payloaddirectory.dev/badge/1314210045-root.svg" alt="Payload Directory"></a>README
A production-ready Razorpay payment adapter for the Payload CMS Ecommerce Plugin.
Integrate Razorpay into your Payload CMS storefront with minimal configuration. This adapter provides seamless payment processing, secure payment verification, and native integration with the Payload Ecommerce payment system.
Built for Payload CMS 3.x, TypeScript, ESM, and Next.js.
Before installing the adapter, ensure your project meets the following requirements.
| Requirement | Version |
|---|---|
| Payload CMS | 3.x |
| @payloadcms/plugin-ecommerce | Latest |
| Node.js | 20+ |
| Razorpay Account | Required |
Install the package using your preferred package manager.
pnpm add @codenik/payload-razorpay
npm install @codenik/payload-razorpay
yarn add @codenik/payload-razorpay
Add the following variables to your .env file.
RAZORPAY_SECRET=your_secret_key
NEXT_PUBLIC_RAZORPAY_KEY_ID=your_publishable_key
Note
Use Test Keys during development and Live Keys in production.
Register the Razorpay adapter with the Payload Ecommerce plugin.
import { ecommercePlugin } from '@payloadcms/plugin-ecommerce'
import { razorpayAdapter } from '@codenik/payload-razorpay'
plugins: [
ecommercePlugin({
payments: {
paymentMethods: [
razorpayAdapter({
publishableKey: process.env.NEXT_PUBLIC_RAZORPAY_KEY_ID!,
secretKey: process.env.RAZORPAY_SECRET!,
}),
],
},
}),
]
Import the client adapter into your frontend application.
import { razorpayAdapterClient } from '@codenik/payload-razorpay'
Initialise the adapter.
const adapter = razorpayAdapterClient({
publishableKey: process.env.NEXT_PUBLIC_RAZORPAY_KEY_ID!,
})
This package provides the Payload CMS payment adapter. To open the Razorpay Checkout on the frontend, install the official react-razorpay package.
pnpm add react-razorpay
npm install react-razorpay
yarn add react-razorpay
Import the required hook and types into your checkout component.
import { RazorpayOrderOptions, useRazorpay } from 'react-razorpay'
const { Razorpay } = useRazorpay()
After calling initiatePayment(), launch the Razorpay Checkout using the returned payment details.
const options: RazorpayOrderOptions = {
key: process.env.NEXT_PUBLIC_RAZORPAY_KEY_ID!,
amount: (paymentData.amount as number) * 100,
currency: 'INR',
name: 'Your Store',
description: 'Order Payment',
order_id: paymentData.paymentIntentID,
handler: async (response) => {
await confirmOrder('razorpay', {
additionalData: {
paymentIntentID: paymentData.paymentIntentID,
razorpay_payment_id: response.razorpay_payment_id,
razorpay_signature: response.razorpay_signature,
},
})
},
}
const razorpay = new Razorpay(options)
razorpay.open()
Important
This package only provides the Payload CMS payment adapter. You are responsible for implementing the checkout UI and calling
initiatePayment()andconfirmOrder()from your frontend application.
Customer clicks Pay
│
▼
initiatePayment()
│
▼
Payload creates a Razorpay Order
│
▼
Open Razorpay Checkout
│
▼
Customer completes payment
│
▼
confirmOrder()
│
▼
Payment verified
│
▼
Payload creates the Order
│
▼
Redirect to Order Confirmation Page
| Feature | Status |
|---|---|
| Razorpay Checkout | ✅ |
| Razorpay Orders API | ✅ |
| Payment Verification | ✅ |
| Transaction Creation | ✅ |
| Payload Ecommerce Integration | ✅ |
| TypeScript | ✅ |
| ESM | ✅ |
| Next.js | ✅ |
| Package | Version |
|---|---|
| Payload CMS | 3.x |
| Node.js | 20+ |
| Next.js | 15+ |
Contributions are welcome!
If you'd like to improve this project, feel free to open an issue or submit a pull request.
MIT License
If you encounter an issue, please include the following information when creating a GitHub issue:
Tags
stripe
Connect Stripe and Payload CMS to work with Stripe data from your Payload project
997.6k/wk45.5kv3 v4
payload ecommerce tpay
Tpay payment adapter for the Payload ecommerce plugin with BLIK, bank transfers and cards for Polish shops
573/wk2v3
payload invoicepdf
Invoice and quote collections with JSX-based PDF generation, email sending and quote acceptance links
422/wk9v3
payload polar
Work-in-progress Payload plugin for integrating
251/wk0v3
payload paystack plugin
Sync Payload collections with Paystack resources through webhooks, a REST proxy and customer blacklisting
213/wk6v3
cloud storage
Store Payload uploads in third-party cloud storage through a generic adapter interface
100473.0k/wk45.5kv3 v4