@sslcommerz.com/react-native-sdk
v0.0.8
Published
React Native wrapper for the SSLCommerz mobile SDK
Maintainers
Readme
@sslcommerz.com/react-native-sdk
React Native wrapper for the SSLCommerz mobile SDK for Android and iOS.
Compatibility
This package is usable in modern React Native apps, but it should still be treated as a native module that benefits from version-aware validation rather than as a universal drop-in package for every project shape.
Current support position
- Library and example app are currently validated on React Native
0.85.0 - iOS requires:
- iOS
15.1+ - CocoaPods
use_frameworks!SSLCommerzSDK ~> 2.1
- iOS
- Android uses:
com.sslcommerz:library:1.0.6- SSL Wireless Maven repository:
https://sdk.sslwireless.com/releases
- Node.js requires:
20.19.4+
Recommended usage for clients
- Safe path: validate this package against the client project's exact React Native, Android Gradle Plugin, Gradle, Kotlin, CocoaPods, and Xcode versions before release.
- Best fit:
projects close to the React Native
0.85.xtoolchain. - Caution:
iOS currently validates best with the source-built React Native CocoaPods path when
use_frameworks! :staticis enabled in the example setup.
Support matrix
| Area | Current status |
| --- | --- |
| React Native 0.85.x style projects | Best validated path |
| Newer React Native projects | Use with validation and expect native compatibility work |
| iOS | Supported through CocoaPods and SSLCommerzSDK |
| Android | Supported through native SSLCommerz Android SDK |
Tested baseline
The following is the closest currently validated baseline for this repository:
| Tooling area | Baseline |
| --- | --- |
| React Native | 0.85.0 |
| React | 19.2.3 |
| Node.js | 20.19.4+ |
| iOS minimum | 15.1+ |
| CocoaPods SDK | SSLCommerzSDK 2.1.x |
| Android SDK dependency | com.sslcommerz:library:1.0.6 |
| Android Gradle Plugin | 8.8.2 |
| Gradle | 8.13 |
| Kotlin plugin | 2.1.20 |
Treat anything meaningfully different from this baseline as a compatibility check, not an automatic support guarantee.
Before using in a client project
- confirm the client app can use
use_frameworks!on iOS - confirm Android build tooling can satisfy newer AndroidX dependencies from the SDK
- confirm the project can run with Node
20.19.4+ - test both
TESTBOXandLIVE - verify success, failure, and SDK close callbacks on real devices
Client Integration Guide
Use this package in a client project only after checking the native prerequisites first.
1. Check the client project's native stack
- React Native version
- Android Gradle Plugin version
- Gradle version
- Kotlin compatibility
- iOS deployment target
- CocoaPods version
- Xcode version
If the client project is much newer than the tested baseline, budget time for native Android and iOS adjustments.
2. Install the package
npm install @sslcommerz.com/react-native-sdkor
yarn add @sslcommerz.com/react-native-sdk3. Complete iOS setup
- run
pod install - confirm the app can use
use_frameworks! - confirm the app deployment target is at least iOS
15.1 - if you use static frameworks, prefer validating on the source-built React Native pod path
4. Complete Android setup
- confirm the SSL Wireless Maven repository is available
- rebuild Gradle dependencies
- if the project uses a newer AndroidX / WebKit stack, confirm the app's Android build tooling is recent enough
5. Validate payment flow before release
- test
TESTBOX - test
LIVE - verify callback behavior for:
- success
- failed transaction
- SDK closed by user
- verify behavior on physical Android and iOS devices
Features
- Start SSLCommerz payments from React Native
- Support for
TESTBOXandLIVESDK modes - Built-in enums for SDK type, currency, and language
- Optional customer, shipment, EMI, additional, and product information
- Callback-based transaction handling for success, failure, and SDK close events
- iOS support through CocoaPods and Android support through the native SSLCommerz SDK
Installation
Install the package:
npm install @sslcommerz.com/react-native-sdkor
yarn add @sslcommerz.com/react-native-sdkiOS
After installing the package, install pods:
cd ios
pod installThen rebuild the app.
Android
No extra manual step is required after installing the package. Rebuild the app so Gradle can resolve the native dependency.
Usage Example
import React from 'react';
import { Button, View } from 'react-native';
import {
AdditionalInfo,
CurrencyType,
CustomerInfo,
EmiTransaction,
Language,
ProductInfo,
SdkType,
SSLCommerzInitialization,
} from '@sslcommerz.com/react-native-sdk';
export default function App() {
const handlePayNow = () => {
const payment = new SSLCommerzInitialization(
'your_store_id',
'your_store_password',
100,
CurrencyType.BDT,
`TXN-${Date.now()}`,
'general',
SdkType.TESTBOX,
Language.English,
'https://your-domain.com/ipn',
'https://your-domain.com/success',
'https://your-domain.com/fail',
'https://your-domain.com/cancel',
'',
'',
''
);
const customer = new CustomerInfo(
'Test Customer',
'01700000000',
'[email protected]',
'Dhaka',
'Dhaka',
'Dhaka',
'1207',
'Bangladesh'
);
payment.setCustomerInfo(customer);
const additional = new AdditionalInfo('valueA', 'valueB', 'valueC', 'valueD');
additional.setInvoiceId('INV-1001');
payment.setAdditionalInfo(additional);
const emi = new EmiTransaction(0);
payment.setEmiTransaction(emi);
const product = new ProductInfo();
product.setGeneral(
'Demo Product',
'general',
100,
0,
0,
0,
'general',
'N/A'
);
payment.setProductInfo(product);
payment.payNow(
(successResponse) => {
console.log('TransactionSuccess', successResponse);
},
(failedResponse) => {
console.log('TransactionFailed', failedResponse);
},
(closedResponse) => {
console.log('Closed', closedResponse);
}
);
};
return (
<View>
<Button title="Pay Now" onPress={handlePayNow} />
</View>
);
}Callback Methods
payNow accepts three callbacks:
transactionSuccessCallback(success_json_response: string)Called when the transaction completes successfully.transactionFailedCallback(error_response: string)Called when the transaction fails or returns a non-success status.sdkClosedCallback(response: string)Called when the SDK screen is closed by the user or by the native SDK.
Example:
payment.payNow(
(successResponse) => {
console.log('Payment successful:', successResponse);
},
(errorResponse) => {
console.log('Payment failed:', errorResponse);
},
(closeResponse) => {
console.log('SDK closed:', closeResponse);
}
);Notes
- Rebuild the app after installing or updating the package.
- On iOS, make sure
pod installhas been run before building. - On iOS, this package expects
use_frameworks!and iOS15.1+. - On Android, make sure the SSL Wireless Maven repository is available if your app does not already inherit it:
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://sdk.sslwireless.com/releases" }
}
}success_url,fail_url, andcancel_urlare part of the library constructor for API compatibility, but native platform support may vary.
Known Integration Risks
- Latest React Native projects may require Android Gradle Plugin, Gradle, Kotlin, or Xcode/CocoaPods alignment before this package builds cleanly.
- iOS projects using React Native prebuilt CocoaPods artifacts may need extra validation; the current validated path uses source-built React Native pods in the example app.
- iOS projects that cannot enable
use_frameworks!may require additional native investigation before integration. - Android projects with older build tooling may fail when resolving newer AndroidX dependencies pulled in by the native SSLCommerz SDK.
- A successful JavaScript install does not guarantee the native iOS and Android layers are already compatible with the client project.
License
SSLCOMMERZ Ltd
