Add this permissions in your Android Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-Openpay API to generate the card token used in Openpay payments
-Card Token for the card payments through their app
-API.
// Example MERCHANT_ID and PUBLIC_API_KEY
final openpay = OpenpayBBVA(
merchantId: "m2tmftuv5jao96rrezj2", // Replace this with your MERCHANT_ID
publicApiKey: "pk_d5e9bff37db4468da3f80148bb94f263", // Replace this with your PUBLIC_API_KEY
productionMode: false, // True if you want production mode on
Country: Country.MX); // Mexico by default, also Colombia & Peru supported
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;
});
}
Future<void> initCardToken() async {
String token;
try {
token = await openpay.getCardToken(
CardInformation(
holderName: 'Jose Perez Cruz',
cardNumber: '5555555555554444',
expirationYear: '23',
expirationMonth: '8',
cvv2: '213',
),
);
} catch (e) {
rethrow;
}
setState(() {
// THIS IS WHERE THE TOKEN IS STORED
_token = token;
});
}
With this information, you can process card payments through Openpay.