openpay2 2.0.6
openpay2: ^2.0.6 copied to clipboard
This is a package that uses the Openpay iOS and Openpay Android libraries to tokenize payments through the Openpay Platform.
Openpay #
Get Started #
Android #
Add this permissions in your Android Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Languages #
Libraries #
-Openpay API to generate the card token used in Openpay payments
-Card Token for the card payments through their app
-API.
Usage #
Initialize Openpay instance #
final openpay = Openpay(
merchantId: "",
publicApiKey: "",
productionMode: false,
Country: Country.MX); // Mexico by default, also Colombia & Peru supported
Get your Device Session ID (iOS and Android only) #
Future<void> initDeviceSession() async {
String deviceID;
try {
deviceID = await openpay.getDeviceID() ?? 'Error getting the device session id';
} catch (e) {
rethrow;
}
}
Get your Card Token #
Future<void> initCardToken() async {
String token;
try {
token = await openpay.getCardToken(
CardInformation(
holderName: 'Holder Card Name',
cardNumber: '1231231231231234',
expirationYear: '26',
expirationMonth: '9',
cvv2: '444',
),
);
} catch (e) {
rethrow;
}
}
With this information, you can process card payments through Openpay.