Expo React Native SDK
The @netappsng/expo-react-native-netappspaysdk is a library that allows developers to integrate the NetappsPay payment gateway into their expo react-native applications. It provides a hook called useNetAppsPay that allows developers to initiate payments with the NetappsPay payment gateway.
Installation
npx expo install @netappsng/expo-react-native-netappspaysdk react-native-webview
Example Usage
import * as React from 'react';
import {NetAppsPayProvider, useNetAppsPay} from '@netappsng/expo-react-native-netappspaysdk';
const payload = {
currency: 'NGN',
amount: 100,
phone:"081******",
tx_ref: "1234",
paymentChannels: 'card,ussd,transfer,payatitude',
email: '[email protected]',
fullname: 'John Doe',
narration: 'Testing',
};
export default function App() {
const { initPayment, cancelPayment, closePaymentModal } = useNetAppsPay({
onFailed: (response) => {
console.log(response, 'Failed');
},
onSuccessful: (response) => {
console.log(response, 'Successful');
},
onCopyUssdCode:(ussdCode)=> {
console.log(ussdCode, 'copy ussd code');
}
});
const handleMakePayment = () => {
initPayment(payload);
};
return (
<NetAppsPayProvider publicKey="Netappspaykey">
<Button onPress={handleMakePayment}>
<Label>Make Payment</Label>
</Button>
</NetAppsPayProvider>
);
}
Updated over 2 years ago
