openpay_bbva 1.0.6
openpay_bbva: ^1.0.6 copied to clipboard
This is a package that uses the Openpay iOS and Openpay Android libraries to tokenize payments through the BBVA Openpay Platform.
Openpay BBVA #
This package integrates the Openpay iOS and Openpay Android libraries, with the Openpay API to generate the Device Session ID used in the Openpay Anti-Fraud System and the Card Token for the card payments through their API.
Usage #
Initialize OpenpayBBVA instance #
// Example MERCHANT_ID and PUBLIC_API_KEY
OpenpayBBVA openpay = OpenpayBBVA(
"m2tmftuv5jao96rrezj2", // Replace this with your MERCHANT_ID
"pk_d5e9bff37db4468da3f80148bb94f263", // Replace this with your PUBLIC_API_KEY
productionMode: false, // True if you want production mode on
opCountry: OpCountry.Mexico); // Mexico by default, also Colombia 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;
}
setState(() {
// THIS IS WHERE THE ID IS STORED
_deviceID = deviceID;
});
}
Get your Card Token #
Future<void> initCardToken() async {
String token;
try {
token = await openpay.getCardToken(
'Jose Perez Cruz', '411111111111111', '8', '23', '213') ??
'Error getting the card token';
} catch (e) {
rethrow;
}
setState(() {
// THIS IS WHERE THE TOKEN IS STORED
_token = token;
});
}
With this information, you can process card payments through Openpay.