npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@interswitchapi/ipg-react-native

v1.0.2

Published

Interswitch Payment Gateway SDK for React Native

Readme

Interswitch Payment Gateway SDK for React Native

The Interswitch Payment Gateway (IPG) SDK for React Native provides a seamless way to integrate secure payment processing into your mobile applications. Built on top of the robust Interswitch Web Checkout, this SDK simplifies the integration process using a high-performance WebView component.

Official Documentation


Features

  • Official Integration: Follows Interswitch Inline Checkout standards.
  • Cross-Platform: Full support for both Expo and React Native CLI.
  • Type Safety: Built with TypeScript for a superior developer experience and fewer runtime errors.
  • Customizable: Control the payment flow with refs, handle custom response data, and style the UI to match your app.

Installation

Install the package via your preferred package manager:

NPM

npm install @interswitchapi/ipg-react-native

Yarn

yarn add @interswitchapi/ipg-react-native

Expo

npx expo install @interswitchapi/ipg-react-native

[!IMPORTANT] This package requires react-native-webview as a peer dependency. Ensure it is installed in your project.


Quick Start

The following example demonstrates a basic implementation where the payment modal starts automatically.

import React, { useState } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { IswPaymentWebView } from '@interswitchapi/ipg-react-native';

export default function App() {
  const [txnRef] = useState(`txn_${Date.now()}`);

  const config = {
    merchantCode: 'MX6072',
    payItemId: '9405967',
    amount: 100000, // Amount in Kobo (e.g., 1000.00 NGN)
    mode: 'TEST' as const,
  };

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Secure Payment</Text>
      <IswPaymentWebView
        amount={config.amount}
        autoStart={true}
        trnxRef={txnRef}
        merchantCode={config.merchantCode}
        payItem={{ id: config.payItemId }}
        mode={config.mode}
        onCompleted={(response) => {
          console.log('Payment Response:', response);
        }}
        style={styles.webView}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, paddingTop: 60, paddingHorizontal: 20 },
  title: {
    fontSize: 22,
    fontWeight: 'bold',
    textAlign: 'center',
    marginBottom: 20,
  },
  webView: { flex: 1 },
});

Advanced Usage

Manual Trigger with Refs

Use the IswWebViewRefMethods to programmatically start() or end() the payment process.

import React, { useRef } from 'react';
import { TouchableOpacity, Text } from 'react-native';
import {
  IswPaymentWebView,
  type IswWebViewRefMethods,
} from '@interswitchapi/ipg-react-native';

export default function PaymentScreen() {
  const paymentRef = useRef<IswWebViewRefMethods>(null);

  return (
    <>
      <TouchableOpacity onPress={() => paymentRef.current?.start()}>
        <Text>Pay Now</Text>
      </TouchableOpacity>

      <IswPaymentWebView
        ref={paymentRef}
        autoStart={false}
        // ... other props
        onCompleted={(res) => console.log(res)}
      />
    </>
  );
}

Handling Custom Response Data

You can pass a generic type to IswPaymentWebView to handle custom data fields returned in the payment callback.

interface MyCustomData {
  orderId: string;
  userId: string;
}

// ... inside your component
<IswPaymentWebView<MyCustomData>
  onCompleted={(response) => {
    console.log('Order ID:', response.orderId);
  }}
  // ...
/>;

API Reference: Props

| Prop | Type | Required | Default | Description | | :--------------- | :------------------ | :------: | :------ | :---------------------------------------------------------- | | trnxRef | string | Yes | - | Unique transaction reference for the session. | | merchantCode | string | Yes | - | Your Interswitch Merchant Code. | | amount | number \| string | Yes | - | Transaction amount in Kobo (e.g., 100000 = 1000.00). | | payItem | IswPayItem | Yes | - | Object containing id (required) and name (optional). | | mode | 'TEST' \| 'LIVE' | Yes | - | Environment for the transaction. | | onCompleted | Function | Yes | - | Callback triggered upon completion, cancellation, or error. | | currency | number \| string | No | 566 | ISO currency code (Default: 566 for NGN). | | customer | IswCustomer | No | - | Optional customer details (id, name, email, phoneNumber). | | autoStart | boolean | No | false | Automatically launch the payment modal on mount. | | showBackdrop | boolean | No | false | Display a loading backdrop while the gateway initializes. | | indicatorColor | ColorValue | No | - | Color for the loading activity indicator. | | loadingText | string | No | - | Custom text displayed during initialization. | | style | ViewStyle | No | - | custom styles for the WebView component. | | backButton | ReactNode | No | - | Custom component for the back/close button. | | tokeniseCard | 'true' \| 'false' | No | - | Flag to request card tokenization for future use. | | splitAccounts | SplitAccounts[] | No | - | Array of accounts for settlement splitting. |


Contributing

We welcome contributions! Please see the Contributing Guide for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with create-react-native-library