react-native-direct-pay-card-payment
v1.1.7
Published
DirectPay Card Payment Library
Downloads
13
Readme
react-native-direct-pay-card-payment
Getting started
$ npm install react-native-direct-pay-card-payment --save
$ cd ios && pod install && cd ..
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-direct-pay-card-payment
and addRNDirectPayCardPayment.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNDirectPayCardPayment.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNDirectPayCardPaymentPackage;
to the imports at the top of the file - Add
new RNDirectPayCardPaymentPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-direct-pay-card-payment' project(':react-native-direct-pay-card-payment').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-direct-pay-card-payment/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-direct-pay-card-payment')
Windows
- In Visual Studio add the
RNDirectPayCardPayment.sln
innode_modules/react-native-direct-pay-card-payment/windows/RNDirectPayCardPayment.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Direct.Pay.Card.Payment.RNDirectPayCardPayment;
to the usings at the top of the file - Add
new RNDirectPayCardPaymentPackage()
to theList<IReactPackage>
returned by thePackages
method
Usage
import RNDirectPayCardPayment from 'react-native-direct-pay-card-payment';
// TODO: What to do with the module?
RNDirectPayCardPayment.addCardToUser(
'dev', //env : dev or prod
'e0e2c6e150775dff22e143af7ba234424', // apiKey
'FN02385', // mid
'8c1eeae8-07cb-4c7b-12334422e4q3', //unique id of the user
'Jhon', // firstname of the user
'Doe', // lastname of the user
'[email protected]', // email of the user
'0730000001', // phone number of the user
(_err, _r) => {
if (_err) {
console.log('code: ' + _err.code);
console.log('message: ' + _err.message);
} else {
//successfully added the card
console.log('id: ' + _r.id); // id (token) of the added card
console.log('mask: ' + _r.mask); // masked card number
console.log('reference: ' + _r.reference); // unique user id as the reference
console.log('brand: ' + _r.brand); // brand of the card (Visa / Mastercared)
}
},
);;