#sandaru
1 messages · Page 1 of 1 (latest)
pi_3N8ireEh0S58XxDe0k5lslcH
This PaymentIntent has a requires_payment_method status.
So the next step is to confirm the PaymentIntent on the frontend with a payment method
So this is what I done. According to the stripe firebase extention I created an doc like below documentation
client: ‘mobile’
mode: ‘payment’
amount: {payment amount}
currency: {currency code}
Here is the code for that. dart Future<String?> createCheckoutSession() async { try { return await firestoreService.addDocument( 'Users/${authService.user.value!.uid}/checkout_sessions', { 'client': 'mobile', 'mode': 'payment', 'amount': int.parse(receiverData.price ?? '') * 100, 'currency': 'USD', }); } catch (e) { closeLoadingDialog(); rethrow; } }
Then I initiated the payment sheet with those data like below dart Future<void> initPaymentSheet(String paymentDocID) async { try { final paymentData = await firestoreService.getDocument( 'Users/${authService.user.value!.uid}/checkout_sessions', paymentDocID, ); await Stripe.instance.initPaymentSheet( paymentSheetParameters: SetupPaymentSheetParameters( customFlow: true, merchantDisplayName: 'ShoutOut', paymentIntentClientSecret: paymentData!['paymentIntentClientSecret'], customerEphemeralKeySecret: paymentData['ephemeralKeySecret'], style: ThemeMode.light, appearance: PaymentSheetAppearance( colors: PaymentSheetAppearanceColors( background: kBottomSheetColor, secondaryText: Colors.grey.shade200, ), ), ), ); } catch (e) { rethrow; } }
Then after I presented the payment sheet.
Is there any other thing that need to done
you'd enter a test card ( https://stripe.com/docs/testing#cards ) into the PaymentSheet and that would attempt the payment.
Yeah I entered a test card
cool, so what other question do you have?
I tried again but the payment shows as incomplete in the dashboard.
I used 4242 4242 4242 4242 as the card
can you take a screenshot of the UI you're looking at when you enter the card?
also , please add a line before Stripe.instance.initPaymentSheet and print the value of paymentData!['paymentIntentClientSecret'] and tell me what that prints
{mode: payment, setupIntentClientSecret: null, amount: 150000, ephemeralKeySecret: ek_test_YWNjdF8xQzl3OG9FaDBTNThYeERlLGo3MjZqT0JqanlkOGZMM1ZnSW8wQzZkZmk1UzIxaFI_00z5d7dk95, paymentIntentClientSecret: pi_3N8jnXEh0S58XxDe0zB4bi5J_secret_6oSqx8d5o2POB9JY22xWzvazj, created: Timestamp(seconds=1684327784, nanoseconds=45000000), client: mobile, currency: USD, customer: cus_Nt45c1NLF30h6u}
so that's a PaymentIntent
so you should not be using SetupPaymentSheetParameters
ah no, sorry, that's incorrect, ignore me.
we don't support that third party flutter library, so I don't really know how it works
cool, so then you press Continue. What happens after that?
I am using flutter_stripe: ^9.2.0
Nothing happened. when pressing continue the sheet close.
can you show me the full code? like including where you call presentPaymentSheet.
ah also you are using customFlow: true,
that's the issue really. The integration is different that way . Maybe that flutter's library's docs are wrong
try it with that value set to false instead and see if it works.
if you use customFlow then you need to do an extra step to process the payment by calling confirmPaymentSheetPayment : https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-flowcontroller
that flutter library's docs are incomplete and don't mention that. You should probably open an issue on their Github page to let them know they should probably change their docs to either not use customFlow:true, or include how to do the extra step.
It works. I set it to the false. Now it shows sucess.
Yeah. In the docs they mentioned as customflow true
And also I have another question. How I can confirm the payment is sucess or not.