Created
March 29, 2023 17:19
-
-
Save ologunB/0f647547658bcdb8191e49a5901d657c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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