Table of Contents
Install
Install the latest version to your package.json
:
// install external dependencies
$ npm install react-native-webview react-native-svg --save
// install package
$ npm install trxact --save
Usage
import UseTrxact from 'trxact';
import { Stage } from 'trxact/Common/Constants';
<View style={styles.container}>
// for saving card checkout
{
UseTrxact.SavePaymentCardCheckout({
sessionToken: "sessionToken",
apiKey: "apiKey",
stage: Stage.Sandbox or Stage.Production,
style: { mainColor: '#000', buttonBorderRadius: 100, inputFieldBorderRadius: 100 },
onSuccess: (res) => console.log('success', res),
onFailure: (res) => console.log('failure', res),
onError: (error) => console.log('error', error)
}
)
}
// for payment checkout
{
UseTrxact.PaymentCheckout({
sessionToken: "sessionToken",
apiKey: "apiKey",
stage: Stage.Sandbox or Stage.Production,
style: { mainColor: '#000', buttonBorderRadius: 100, inputFieldBorderRadius: 100 },
onSuccess: (res) => console.log('success', res),
onFailure: (res) => console.log('failure', res),
onError: (error) => console.log('error', error)
}
)
}
</View>
Properties
All of the following properties are required
-
sessionToken
(string): The session token for the session which you initiated before through our APIs. -
apiKey
(string): Your integration API Key; this to be able to call our APIs. -
stage
(Enum): The desired environment stage; available values areStage.Staging or Stage.Sandbox or Stage.Production
. -
style
(object): This is custom style for you-
mainColor
(string): This is the main color. -
buttonBorderRadius
(string): This is the border radius that will be applied on any button. -
inputFieldBorderRadius
(string): This is the border radius that will be applied on any input field.
-
Events
-
onSuccess
: Called once when the process is succeeded. -
onFailure
: Called once when the process is failed. -
onError
: Called whenever an error occured.