xpresspayonline-react-native
Version:
xpresspayonline react native plugin
90 lines (72 loc) • 2.32 kB
Markdown
# README #
Requirements
Nodejs
React-native
React-native-webview
### What is this repository for? ###
* This is a react native library to integrate xpresspayonline react native pluging
* more information at https://docs.xpresspayonline.com
* Version 1.0.0
### How do I get set up? ###
* npm install xpresspayonline-react-native
* Or
* yarn add xpresspayonline-react-native
run
* react-native link react-native-webview
* refer to documentation https://github.com/react-native-webview/react-native-webview/blob/master/docs/Getting-Started.md
### Who do I talk to? ###
* applicationsupport@xpresspayments.com
###
* Example ussage
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as PayWithXpresspayOnline from 'xpresspayonline-react-native';
export default function App() {
const options = {
"publicKey": “Your public key” here,
"logoURL": "",
"transactionId": “Your Transaction Id here”,
"amount": 100,
"currency": "NGN",
"country": "NG",
"email": “aminu.kabunu@gmail.com”,
"phoneNumber": "07063703099",
"firstName": "Aminu",
"lastName": "Cincin",
"hash": "",
"meta": [{
"metaName": "DSTV NUMBER",
"metaValue": "075632145555”
}],
"callbackUrl”:”www.example.com/callback“,
"env": "LIVE"
}
function handleOnRedirect(data) {
if(data['status-code'] === '11') {
alert('payment cancelled');
}
if(data['status-code'] === '08') {
alert('payment processing');
//requery the transaction with the requery endpoins as in the docs. https://docs.xpresspayonline.com/docs/re-query-payment
}
if(data['status-code'] === '099' || data['status-code'] === '098') {
alert('payment failed');
//requery the transaction with the requery endpoins as in the docs. https://docs.xpresspayonline.com/docs/re-query-payment
}
}
return (
<View style={styles.container}>
<Text>Should load the xpresspayonline payment gatewat shortly ...</Text>
<PayWithXpresspayOnline onRedirect={handleOnRedirect} options={options}/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});