openCheckoutCard method
Implementation
Future<bool> openCheckoutCard(int amount, String desc, String clientPhone, String companyName, String currency, String stripeSecret,
Function(String) onSuccess) async {
Map<String, dynamic>? paymentIntent = await createPaymentIntent(amount.toString(), currency, stripeSecret);
if (paymentIntent == null)
return false;
dprint(paymentIntent.toString());
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
applePay: true,
googlePay: true,
style: ThemeMode.dark,
testEnv: true,
// merchantCountryCode: 'UK',
merchantDisplayName: companyName,
customerId: paymentIntent['customer'],
paymentIntentClientSecret: paymentIntent['client_secret'],
// customerEphemeralKeySecret: paymentIntent['ephemeralKey'],
),
);
await Stripe.instance.presentPaymentSheet(
// parameters: PresentPaymentSheetParameters(
// clientSecret: paymentIntent['client_secret'],
// confirmPayment: true,
// )
);
dprint("Payment $currency${amount/100} stripe:${paymentIntent["id"]}");
onSuccess("Payment $currency${amount/100} stripe:${paymentIntent["id"]}");
return true;
}