Skip to content

techquest/dfs-card-tokenization-sdk-react-native

Repository files navigation

Interswitch Card Tokenization SDK Sample – React Native

The Interswitch Card Tokenization SDK allows you to securely collect and tokenize card details within your mobile application. The SDK handles the entire tokenization flow - card entry, encryption, OTP verification, and token delivery - through a built-in, pre-styled UI. You receive a single token reference on success, with no raw card data ever passing through the app using the SDK.

Built for the interswitch-card-tokenization package. Works React Native 0.83+ (New Architecture / TurboModules enabled).


1. Install

# yarn
yarn add interswitch-card-tokenization

# npm
npm install interswitch-card-tokenization --ignore-scripts

iOS setup

cd ios && pod install && cd ..

Android

No extra steps. Min SDK 24+. The module auto-links with React Native 0.60+.

2. API Reference

The SDK exports a TurboModule with this exact spec:

export interface Spec extends TurboModule {
  initializeSDK(
    clientId: string,
    clientSecret: string,
    customerPhoneNumber: string,
    customerEmail: string
  ): Promise<boolean>;

  launch(
    onSuccess: (tokenReference: string) => void,
    onError: (error: string) => void,
    onCancelled: () => void
  ): void;
}

initializeSDK

Initializes the secure tokenization session for a specific customer. Must be called before launch.

Parameters

  • clientId – from Interswitch
  • clientSecret – from Interswitch
  • customerPhoneNumber – e.g. 2348012345678.
  • customerEmail – valid email.

Returns Promise – true if ready.

launch

Opens the Interswitch secure UI to capture card details. No card data touches your app.

Callbacks:

  • onSuccess(tokenReference) – reusable token.
  • onError(error) – user-facing error string
  • onCancelled() – user closed the sheet

3. Quick Start

import InterswitchCardTokenization from 'interswitch-card-tokenization';

async function initialize() {
  const ok = await InterswitchCardTokenization.initializeSDK(
    'YOUR_CLIENT_ID',
    'YOUR_CLIENT_SECRET',
    '2348012345678',
    'customer@email.com'
  );
  
  if (!ok) throw new Error('SDK init failed');
}

function tokenizeCard() {
  InterswitchCardTokenization.launch(
    (tokenReference: string) => {
      console.log('Token:', tokenReference);
    },
    (error: string) => {
      console.warn('Tokenization error:', error);
    },
    () => {
      console.log('User cancelled');
    }
  );
}

Contributing

We welcome contributions! Please create an issue or submit a pull request for enhancements and bug fixes.

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors