Back to Developers

REACT NATIVE / SETUP GUIDE

Connect your mobile app.

Install the downloadable SDK, version 0.2.1, in your React Native application.

01

Prepare your app

Use React Native 0.72+, or an Expo development build with native modules enabled. The SDK uses react-native-webview 13.8+ and react-native-safe-area-context 4.8+. iOS builds require Xcode and CocoaPods on macOS.

Your merchant backend creates the payment and returns its HTTPS checkout URL. Keep API credentials, order amounts and authoritative payment-status checks on your backend.

02

Install the downloaded package

Download SDK package

Place the TGZ file in your app directory and run:

npm install ./merchantpaisa-react-native-sdk-0.2.1.tgz react-native-webview react-native-safe-area-context

For iOS, install the native dependencies:

cd ios
pod install

For Expo, install the two native dependencies with npx expo install and rebuild your development app.

03

Open hosted checkout

Pass the HTTPS checkout URL supplied by your backend to the checkout component. Wire onVerify to your own server’s order-status request.

import React, { useState } from 'react';
import { Button, Text, View } from 'react-native';
import { MerchantPaisaCheckout } from '@merchantpaisa/react-native-sdk';

// checkoutUrl is created by your backend for this order.
// onVerify asks your backend for the order's payment status.
export function Checkout({ checkoutUrl, onVerify }: {
  checkoutUrl: string;
  onVerify: () => void;
}) {
  const [visible, setVisible] = useState(false);
  const [message, setMessage] = useState('');
  const finish = () => { setVisible(false); onVerify(); };
  return (
    <View>
      <Button title="Open checkout" onPress={() => setVisible(true)} />
      <Text accessibilityLiveRegion="polite">{message}</Text>
      <MerchantPaisaCheckout
        visible={visible}
        checkoutUrl={checkoutUrl}
        onClose={finish}
        onReturn={finish}
        onResume={onVerify}
        onError={() => setMessage('Please check your connection and order status.')}
      />
    </View>
  );
}
04

Verify the payment outcome

Check the order with your backend when checkout closes, returns or the app resumes. Show payment success only after the server confirms it. Keep pending or uncertain results pending until reconciled.

If your hosted checkout uses a return address, pass the exact HTTPS address in returnUrl. The callback reports navigation; it does not confirm a payment. Use appearance to configure the checkout shell’s colors.