Skip to main content

React Native

Integrate this SDK with your React Native App (both iOS and Android) and start accepting payments from your customers.

SAMPLE EXPERIENCE

Compatibilities and Dependencies

React Native Version Support

React Native VersionSupport StatusNotes
^0.70.0✅ SupportedMinimum supported version
^0.71.0✅ SupportedRecommended version
^0.72.0✅ SupportedRecommended version
^0.73.0✅ SupportedLatest stable version
^0.74.0✅ SupportedLatest stable version
^0.75.0✅ SupportedLatest stable version
^0.76.0✅ SupportedLatest stable version

Node.js Version Support

Node.js VersionSupport StatusNotes
^16.0.0✅ SupportedMinimum supported version
^18.0.0✅ SupportedRecommended version
^20.0.0✅ SupportedLatest LTS version
^21.0.0✅ SupportedLatest stable version

Platform Support

PlatformSupport StatusMinimum Version
Android✅ SupportedAPI Level 21 (Android 5.0)
iOS✅ SupportediOS 13.0+

Install Nimbbl React Native SDK

npm install nimbbl-mobile-react-native-sdk

Import and Initialize the SDK

Import the NimbblSDK class and initialize it before using it in your application.

import { NimbblSDK } from 'nimbbl-mobile-react-native-sdk';

// Get the shared instance
const nimbblSDK = NimbblSDK.getSharedInstance();

// Initialize the SDK (no credentials required)
await nimbblSDK.initialize();

Launching the Nimbbl Checkout

IMPORTANT

In order to invoke the checkout, your server should provide you the following information:

The SDK uses a method-based approach for payment processing. You can process payments using the checkout method with your order token.

Understanding Checkout Options

Nimbbl lets you enforce a payment mode on the Checkout. This can be done by passing the paymentModeCode property. There are other related properties for each different payment mode, you can read them in the table below. If you don't pass paymentModeCode the customer is shown the full Checkout with all available payment modes.

PropertiesTypeMandatory?Description
orderTokenstringtrueOrder token generated via Creating an Order step
paymentModeCodestringfalseIn case of specific payment mode, this property is mandatory. Possible values net_banking, card, upi, wallet. If you don't pass paymentModeCode the customer is shown the full Checkout with all available payment modes.
bankCodestringfalseOnly to be passed in case of net_banking. Example: hdfc. To get the full list of banks supported for you, please use this API. If it isn't passed, Checkout will open with a page for the user to choose their bank from enabled banks
walletCodestringfalseOnly to be passed in case of wallet. Example: jio_money. To get the full list of wallets supported for you, please use this API. If it isn't passed, Checkout will open with a page for the user to choose their wallet from enabled wallets
paymentFlowstringfalseOnly to be passed in case of upi to determine the flow. Possible value is intent. If it isn't passed, Checkout will open with page for the user to pay using a QR or choose a UPI app
upiAppCodestringfalseOnly to be passed in case of upi and paymentFlow is intent. Possible values phonepe, gpay. Checkout will open with the transaction initiated for the upi app passed in the upiAppCode field. If it isn't passed, Checkout will show a UPI QR or prompt user to choose a UPI app

Process Payment

Use the checkout method to process payments:

// Process payment using checkout method
const result = await nimbblSDK.checkout({
orderToken: 'YOUR_ORDER_TOKEN', // Required: Get this from your backend
paymentModeCode: 'upi', // Optional: 'net_banking', 'card', 'upi', 'wallet' or '' for all
bankCode: 'hdfc', // Optional: Only for 'net_banking'. Bank code for specific bank
walletCode: 'jio_money', // Optional: Only for 'wallet'. Wallet code for specific wallet
paymentFlow: 'intent', // Optional: Only for 'upi' 'intent'
upiAppCode: 'phonepe' // Optional: Only for 'upi' with paymentFlow 'intent'. 'phonepe' or 'gpay'
});

Response Handling

The SDK returns payment responses directly from the checkout method. Handle the response after the checkout call completes.

import { NimbblSDK } from 'nimbbl-mobile-react-native-sdk';

const nimbblSDK = NimbblSDK.getSharedInstance();

// Initialize SDK
await nimbblSDK.initialize();

// Start payment and handle response
try {
const checkoutResult = await nimbblSDK.checkout({
orderToken: 'YOUR_ORDER_TOKEN', // Get from your backend
paymentModeCode: 'upi', // Optional: 'net_banking', 'card', 'upi', 'wallet' or '' for all
bankCode: 'hdfc', // Optional: Only for 'net_banking'. Bank code for specific bank
walletCode: 'jio_money', // Optional: Only for 'wallet'. Wallet code for specific wallet
paymentFlow: 'intent', // Optional: Only for 'upi' 'intent'
upiAppCode: 'phonepe' // Optional: Only for 'upi' with paymentFlow 'intent'. 'phonepe' or 'gpay'
});

// Handle the response
if (checkoutResult.status === 'success') {
// Payment successful
console.log('Payment successful:', checkoutResult);
console.log('Order ID:', checkoutResult.order_id);
console.log('Transaction ID:', checkoutResult.transaction_id);
} else {
// Payment failed
console.log('Payment failed:', checkoutResult);
console.log('Message:', checkoutResult.message);
}
} catch (error) {
// Handle SDK errors
console.error('Payment error:', error);
}

Complete Integration Example

Here's a complete example showing how to integrate the Nimbbl SDK in your React Native app:

import React, { useEffect } from 'react';
import { View, Button, Alert } from 'react-native';
import { NimbblSDK } from 'nimbbl-mobile-react-native-sdk';

const PaymentScreen = () => {
const nimbblSDK = NimbblSDK.getSharedInstance();

useEffect(() => {
// Initialize SDK on component mount
const initSDK = async () => {
await nimbblSDK.initialize();
};
initSDK();
}, []);

const handlePayment = async () => {
try {
const result = await nimbblSDK.checkout({
orderToken: 'YOUR_ORDER_TOKEN', // Get from your backend
paymentModeCode: 'upi', // Optional: 'net_banking', 'card', 'upi', 'wallet' or '' for all
bankCode: 'hdfc', // Optional: Only for 'net_banking'. Bank code for specific bank
walletCode: 'jio_money', // Optional: Only for 'wallet'. Wallet code for specific wallet
paymentFlow: 'intent', // Optional: Only for 'upi' 'intent'
upiAppCode: 'phonepe' // Optional: Only for 'upi' with paymentFlow 'intent'. 'phonepe' or 'gpay'
});

// Handle payment result
if (result.status === 'success') {
// Payment successful
Alert.alert('Success', `Payment successful! Order ID: ${result.order_id}`);
console.log('Payment successful:', result);
} else {
// Payment failed
Alert.alert('Failed', `Payment failed: ${result.message}`);
console.log('Payment failed:', result);
}
} catch (error) {
// Handle SDK errors
Alert.alert('Error', `Payment error: ${error}`);
console.error('Payment error:', error);
}
};

return (
<View>
<Button title="Pay Now" onPress={handlePayment} />
</View>
);
};

export default PaymentScreen;

Capture Transaction Response

The SDK returns a unified response object containing all payment details. This response should be sent to your server for validation.

Response Data Structure

FieldTypeDescription
statusstringPayment status: "success", "failed", "cancelled"
order_idstringYour order ID
nimbbl_order_idstringNimbbl's internal order ID
transaction_idstringTransaction ID
nimbbl_transaction_idstringNimbbl's internal transaction ID
signaturestringPayment signature for verification
messagestringStatus message
reasonstringFailure reason (if applicable)
orderobjectComplete order details including amount, currency, etc.

Example Response

{
"status": "success",
"order_id": "order_12345",
"nimbbl_order_id": "order_RoQ7Zl92G2qqB3rg",
"transaction_id": "txn_67890",
"nimbbl_transaction_id": "order_RoQ7Zl92G2qqB3rg-20210217071936",
"signature": "hmac_sha256",
"message": "Payment successful",
"order": {
"amount": 100.0,
"currency": "INR",
"invoice_id": "inv_123"
}
}
IMPORTANT
  • Share the complete response object to your server for validation
  • Verify the signature on your server before providing goods or services
  • More details available on processing the response in Completing the Integration

Platform Setup

iOS Setup

  1. Install pods:
cd ios && pod install
  1. Add to your Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
  1. Add URL Schemes to your Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>gpay</string>
<string>phonepe</string>
<string>paytmmp</string>
</array>

Note:

  • The iOS implementation is written in Swift for modern, type-safe development.
  • The SDK uses iOS native SDK v2.0.16.

Android Setup

No additional setup required - the SDK uses autolinking.

  1. Add to your android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 21
}
}
  1. Add to your android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />

Note:

  • The Android implementation is written in Kotlin for modern, type-safe development.
  • The SDK uses Android native SDK v4.0.9.