react-native-momo
This is the test sdk for webview.
General Requirements
The minimum requirements for the SDK are:
- iOS 12.0 and higher
- Android minSdkVersion 21
- Android compileSdkVersion 33
Installation
yarn add react-native-momo
After the installation is complete, for iOS run:
npx pod-install
or
cd ios
pod install
Usage
Initialize the SDK
Add the following imports
import {startOnrampSDK, onRampSDKNativeEvent} from 'react-native-momo';
Initialize the SDK by calling the startOnrampSDK
function and pass the basic config parametes to start the sdk.
startOnrampSDK({
appId: 1, // replace this with the appID you got during onboarding
walletAddress: '0x49...436B', // replace with user's wallet address
flowtype: 1 // 1 -> onramp || 2 -> offramp || 3 -> Merchant checkout
fiatType: 1 // 1 -> INR || 2 -> TRY
paymentMethod: 1 // 1 -> Instant transafer(UPI) || 2 -> Bank transfer(IMPS/FAST)
// ... pass other configs here
});
Listening to SDK Events
Add onRampSDKNativeEvent
listener in your component where you've initialized the sdk.
React.useEffect(() => {
const onRampEventListener = onRampSDKNativeEvent.addListener(
'widgetEvents',
eventData => {
// handle all the events here
console.log('Received onRampEvent:', eventData);
},
);
return () => {
onRampEventListener.remove();
};
}, []);
License
MIT
Made with create-react-native-library