@bitnet-infotech/react-native-razorpay-nitro
v1.0.0
Published
High-performance React Native wrapper for Razorpay payments, built with Nitro Modules. Drop-in compatible with react-native-razorpay.
Downloads
121
Readme
react-native-razorpay-nitro
💳 High-performance Razorpay payment SDK for React Native, powered by Nitro Modules. Drop-in compatible with the official package.
📖 Usage • 🔄 Migration • 📚 API Reference
✨ Features
| Feature | Description |
| :--- | :--- |
| ⚡️ Nitro-Powered | Built with Nitro Modules for ultra-low overhead native calls |
| 🏗️ New Architecture Ready | Full Fabric & TurboModules support out of the box |
| 📱 16KB Page Size | Android SDK v1.6.40 compliant with new page size requirements |
| 🍎 Apple Silicon Native | arm64 simulator support for M1/M2/M3/M4 Macs |
| 🔄 Drop-in Compatible | Same API as react-native-razorpay - just change the import |
| 📦 TypeScript First | Full type definitions with JSDoc documentation |
🚀 Why This Package?
The official react-native-razorpay package has two critical issues:
- No New Architecture support - Doesn't work with Fabric/TurboModules
- Android 16KB page size - Fails on devices with new memory page requirements
This package solves both while maintaining 100% API compatibility.
📦 Installation
npm install react-native-razorpay-nitro react-native-nitro-modules
# or
yarn add react-native-razorpay-nitro react-native-nitro-modules
# or
bun add react-native-razorpay-nitro react-native-nitro-modulesiOS
cd ios && bundle exec pod installNote: Uses
razorpay-core-pod 1.0.4with native arm64 simulator support.
Android
No additional setup required. Auto-links with Razorpay SDK v1.6.40.
🔄 Migration from react-native-razorpay
Simply change your import - that's it!
- import RazorpayCheckout from 'react-native-razorpay';
+ import RazorpayCheckout from 'react-native-razorpay-nitro';The API is identical. No code changes required.
💡 Usage
import RazorpayCheckout from 'react-native-razorpay-nitro';
const options = {
key: 'your_razorpay_key',
amount: 50000, // in paise (₹500)
currency: 'INR',
name: 'Your Company',
description: 'Payment for order #123',
order_id: 'order_xxxxx', // from your backend
prefill: {
email: '[email protected]',
contact: '9999999999',
name: 'Customer Name',
},
theme: {
color: '#F37254',
},
};
// Promise-style (recommended)
try {
const data = await RazorpayCheckout.open(options);
console.log('Payment successful!');
console.log('Payment ID:', data.razorpay_payment_id);
console.log('Order ID:', data.razorpay_order_id);
console.log('Signature:', data.razorpay_signature);
} catch (error) {
console.log('Payment failed:', error.code, error.description);
}
// Callback-style (also supported)
RazorpayCheckout.open(
options,
(data) => console.log('Success:', data.razorpay_payment_id),
(error) => console.log('Error:', error.code, error.description)
);📚 API Reference
RazorpayCheckout.open(options, successCallback?, errorCallback?)
Opens the Razorpay checkout modal.
Parameters:
options- Checkout configuration objectsuccessCallback- Optional callback for successerrorCallback- Optional callback for errors
Returns: Promise<SuccessResponse>
CheckoutOptions
| Property | Type | Required | Description |
|----------|------|:--------:|-------------|
| key | string | ✅ | Your Razorpay API key |
| amount | number | ✅ | Amount in paise |
| currency | string | ✅ | Currency code (e.g., 'INR') |
| order_id | string | ✅ | Order ID from backend |
| name | string | | Business name |
| description | string | | Payment description |
| image | string | | Logo URL |
| prefill | object | | Customer details |
| theme | object | | UI customization |
| notes | object | | Additional metadata |
See Razorpay Mobile SDK Docs for complete options.
RazorpayCheckout.onExternalWalletSelection(callback)
Register a callback for external wallet selection (PayTM, PhonePe, etc.).
RazorpayCheckout.onExternalWalletSelection((data) => {
console.log('External wallet selected:', data.external_wallet);
});ExternalWalletResponse:
{
external_wallet: string // e.g., 'paytm', 'phonepe'
razorpay_payment_id?: string
razorpay_order_id?: string
}Response Types
// Success
interface SuccessResponse {
razorpay_payment_id: string
razorpay_order_id: string
razorpay_signature: string
}
// Error
interface ErrorResponse {
code: number
description: string
}📋 Requirements
| Requirement | Version | |-------------|---------| | React Native | 0.71+ | | iOS | 13.0+ | | Android SDK | 24+ | | react-native-nitro-modules | 0.31+ |
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue here first.
❓ Troubleshooting
"SDK Compatibility Status" dialog on Android:
- This dialog only appears in debug builds and is by design from Razorpay SDK
- It will NOT appear in release builds
- No action needed - this is normal behavior during development
iOS simulator crashes on Intel Mac:
- Uses
razorpay-core-pod 1.0.4with arm64 support - Run
pod installto ensure correct version
Payment fails silently:
- Check that
order_idis valid and not expired - Verify API key matches environment (test/live)
📄 License
MIT
