Skip to content

Instantly share code, notes, and snippets.

@ologunB
Created March 29, 2023 17:19
Show Gist options
  • Save ologunB/0f647547658bcdb8191e49a5901d657c to your computer and use it in GitHub Desktop.
Save ologunB/0f647547658bcdb8191e49a5901d657c to your computer and use it in GitHub Desktop.
setState(() {
isLoading = true;
});
HttpsCallable callable =
FirebaseFunctions.instance.httpsCallable('stripePayment');
var serverData =
await callable.call({'amount': ((widget.quoteModel.price + 4.55) * 100).toInt()});
Logger().d(serverData.data);
if(serverData.data == null){
showSnackBar(context, null, 'Error Processing Payment');
return;
}
String payIntent = serverData.data['client_secret'];
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
applePay: false,
googlePay: true,
style: ThemeMode.light,
testEnv: true,
merchantCountryCode: 'CA',
merchantDisplayName: AppCache.getUser.name,
customerId: AppCache.getUser.uid,
paymentIntentClientSecret: payIntent,
));
await Stripe.instance.presentPaymentSheet();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment