Payze is the best software platform for running an internet business. We handle money movement flow for our customers by giving them tools they need.
Install the package in your project
npm install @payze/payze-rn
Payze SKD uses react-native-webview , so you need to install it in your project too
expo install react-native-webview
and you should be good to go.
npm i react-native-webview
From react-native 0.60 autolinking will take care of the link step but don't forget to run pod install
.
NOTE: If you ever need to uninstall React Native react-native-webview , run react-native unlink react-native-webview
to unlink it.
If using CocoaPods, in the ios/
or macos/
directory run:
$ pod install
import React, { useRef } from 'react';
import Payze from "@payze/payze-rn";
// Transaction id given by Payze
const TRANSACTION_ID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
const info = {
cardNumber: "123456789101",
cardHolder: "NAME SURNAME",
expirationDate: "01/22",
securityNumber: "000",
billingAddress: "Address",
};
export default function App() {
const payMethod = useRef();
const setPayMethod = (pay) => (payMethod.current = pay);
const onSuccess = () => alert("SUCCESS!");
const onError = (errorCode) => alert(`ERROR! ${errorCode}`);
const pay = () => {
payMethod.current(
info.cardNumber,
info.cardHolder,
info.expirationDate,
info.securityNumber,
TRANSACTION_ID,
info.billingAddress,
onSuccess,
onError
);
}
return (
...
...
<Payze setPay={setPayMethod} />
)
}
For complete example, please visit Payze example project
Prop | Type | Default | Note |
---|---|---|---|
setPay |
Method, Required |
Method that takes single argument - Pay() method (see the signature, below). | |
closeButtonTitle |
String |
close |
Title of the modal's close button |
closeButtonTextStyle |
Object |
Object to stylise close button |
Argument | Type | Default | Note |
---|---|---|---|
cardNumber |
String, Required |
Number of the card. | |
cardHolder |
String, Required |
Holder of the card. | |
expirationDate |
String, Required |
Expiration date of the card. | |
securityNumber |
String, Required |
CVC/CVV of the card. | |
transactionId |
String, Required |
Transaction id given by Payze. | |
billingAddress |
String, Required |
Billing address of user (can be an empty string). | |
onSuccess |
Method, Required |
Method to be called after a successful transaction. | |
onError |
Method, Required |
Method to be called after an error while trying to process transaction, that takes errorCode as an argument. |
type errorCode {
BAD_REQUEST: 1002,
CARD_VERIFICATION_CANCELLED: 1003,
TRANSACTION_FAILURE: 1004,
UNKNOWN_ERROR: 1005,
}
Distributed under the MIT License. See LICENSE.txt
for more information.