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-tokenizationpackage. Works React Native 0.83+ (New Architecture / TurboModules enabled).
# yarn
yarn add interswitch-card-tokenization
# npm
npm install interswitch-card-tokenization --ignore-scriptscd ios && pod install && cd ..No extra steps. Min SDK 24+. The module auto-links with React Native 0.60+.
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;
}Initializes the secure tokenization session for a specific customer. Must be called before launch.
Parameters
clientId– from InterswitchclientSecret– from InterswitchcustomerPhoneNumber– e.g. 2348012345678.customerEmail– valid email.
Returns Promise – true if ready.
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 stringonCancelled()– user closed the sheet
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');
}
);
}We welcome contributions! Please create an issue or submit a pull request for enhancements and bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.