React Native SDK
The @netappsng/react-native-netappspaysdk is a library that allows developers to integrate the Netappspay payment gateway into their React-native applications. It provides a hook called useNetAppsPay that allows developers to initiate payments with the Netappspay payment gateway.
Installation
npm install @netappsng/react-native-netappspaysdk
or
yarn add @netappsng/react-native-netappspaysdk
Example Usage
import * as React from 'react';
import {NetAppsPayProvider, useNetAppsPay} from '@netappsng/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 about 2 years ago
