startCheckout static method
Start a checkout for the given preference
This method return a PaymentResult with the payment information, if any or the error code.
The publicKey should be the key provided by MercadoPago in the App Credentials page. Do not use the Access Token here.
The preference ID should be generated in the backend used by your app with all the settings. You can personalize several aspects of the checkout. See www.mercadopago.com.ar/developers/es/guides/payments/mobile-checkout/personalization/ for more details.
Implementation
static Future<PaymentResult> startCheckout(
String publicKey,
String preferenceId,
) async {
Map<String, dynamic>? result =
await (_channel.invokeMapMethod<String, dynamic>(
'startCheckout',
{
"publicKey": publicKey,
"preferenceId": preferenceId,
},
));
return PaymentResult.fromJson(result!);
}