#sowmyans-flutter-auth-capture
1 messages Β· Page 1 of 1 (latest)
So sorry - completely forgot to circle back to this!
To start off - yes, it's totally fine to do separate auth and capture with digital wallets like google and apple pay
I don't know the specifics of how the flutter_stripe plugin works, but I believe all you'd have to do is change your server-side code to set capture_method: manual (see https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method). When you want to capture the funds you'd have to make another request to do the capture (https://stripe.com/docs/api/payment_intents/capture)
Thanks yes ie what was documented. But in our case we need to use the saved cards, documentation is not giving clarity on how to find the default paymenthod if we have multiple payment methods for the same customer? Also not clarifying how we can do the same for apple wallet and google pay scenarios. It would be great if we have the documentation for flutter as well here same as react-native : https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#charge-saved-payment-method
Hello, karbi had to step out. Catching up here...
So to be clear those remaining questions are mostly with displaying those on the front end with flutter-stripe correct?
Or is this a question of how to look those up server side?
Thanks, if we can get directions on how we can give a similar user experience and payment to the users as uber/Lyft and accomplish the hold and capture method using stripe + flutter is what we are looking for.
Server side question we have is : how to get the default payment method to attach for the scenario mentioned here : https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#charge-saved-payment-method , that documentation says provide the payment method id, but not sharing any insights on how we can give customer preferred payment method id if they have multiple payment methods
So that will typically be one of two fields on the Customer object. Either invoice_settings.default_payment_method or default_source
https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
https://stripe.com/docs/api/customers/object#customer_object-default_source
Though those won't typically be set automatically, they have to be set explicitly via the API, dashboard, or customer portal
Ok thanks, regarding the question on building the payment experience as uber/Lyft using flutter. Can you provide any guidelines on it, please?
What part of that are you looking for clarification on? I see we have covered how to hold funds on a payment method and how to look up a customer's default payment method, are you trying to figure out how to use those together? Or are you asking about some other aspect of that flow?
Mostly around how to implement the user experience on the flutter (cilent) side with stripe. e.g how we can get the authorization hold on the fund from the flutter, how to make a default payment method from the flutter (to attach it part of the customer). how to save the card and use it without asking the user to authorize each time when we make hold before the service etc. It seems you have good doc on react-native but couldn't find any for flutter, specifically for the scenarios mentioned
I can't help with the client side aspects of that but can certainly point the way on the server side parts
Apologies, never followed up on that. After reading through your description again, I am still a bit unclear on where you are stuck. Are you already collecting the Payment Method details and are trying to figure out how to re-use them when holding funds?
Thanks again for your help here. It seems the flutter stripe plugin is not providing the capabilities that we are looking for. Yes, we still don't have clarity on how to move forward with it for Stripe as the payment gateway. Seems Lyft is using Stripe and we are looking for exactly how Lyft implemented in their mobile app. We just need to know how to do this in flutter using the flutter stripe plugin.
Hello! I'm taking over, catching up now...
As far as I know what you're asking about should be possible, although I can't be sure as Flutter isn't officially supported by Stripe and you're using a third-party library. What specific functionality in the Lyft app are you having trouble implementing with Flutter?
Got it , it seems Stripe is funding this open source project and it will be great if we can fill any feature parities. https://opencollective.com/flutter_stripe , we are looking for the rider payment experience like, onboarding payment options, have the option to use the default payment option for each ride, ability to change the default payment for each ride, authorize the payment to hold an estimate amount and capture the actual amount after the ride. With the stripe flutter plugin , it is not allowing us to authorize the payment using a default payment method without user clicking on the paymentsheet where as in Lyft it authorize the default card.
Sorry, not sure I understand what you mean. What you're describing seems possible with the Flutter library as far as I know. Have you tried using this to confirm a Payment Intent using an existing Payment Method without the payment sheet? https://pub.dev/documentation/flutter_stripe/latest/flutter_stripe/Stripe/confirmPayment.html
The Payment Intent would be created on your server and have an existing PaymentΒ Method attached to it.
How we can attach an existing payment method while we are creating the payment intent of the customer has multiple payment intents ? How do we know customers preferred payment method with the flutter plug-in ? Also, how we can do the same with wallet like Apple Pay or google pay ?
How we can attach an existing payment method while we are creating the payment intent of the customer has multiple payment intents ?
You would do this on your server by creating or updating a Payment Intent withpayment_methodset to an existing Payment Method: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
How do we know customers preferred payment method with the flutter plug-in ?
There are a lot of ways to do this. Many people use metadata or set theinvoice_settings.default_payment_methodon a Customer and reference that: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Also, how we can do the same with wallet like Apple Pay or google pay ?
That's a very broad question, can you be more specific?
catching up ~
Our first challenge is flutter stripe package is not setting up the customer's default payment method, here are more details: https://github.com/flutter-stripe/flutter_stripe/discussions/512 , since we dont have the access the customer's preferred payment methods in the client not sure how we can make it work. Regarding the apple wallet, in order to get the payment details in the server it seems we need setup intent and it seems stripe doesn't support apple wallet and google pay for the same as per this issue https://github.com/flutter-stripe/flutter_stripe/issues/426
When adding multiple cards all of them are listed in the customer's payment methods but not one of them is set as default. Is there a way to set it as a default? (flutter shows the payment ...
Generally the setting up customer default payment method step should be done on server as Rubeus mentioned. I don't have a flutter project setup on my side, let me quick reference from other platform/libraries
Thanks @vivid glen , what we are missing is how to get the paymentmethod_id while creating the payment_intent in the server using flutter stripe : https://stripe.com/docs/payments/save-and-reuse?platform=ios&ui=payment-sheet#ios-charge-saved-payment-method, we thought that we can retrieve it from the customer objects default source or / invoice.defaultsource but it is null. If you can help us to clarify how exactly paymethod id is getting even for native ios or android scenario is good too.
Also need to confirm the apple wallet/google pay support for the same. Didnt get the clarity from the documentation, only the details what we have is from the github issue shared above
So, every client libraries doesn't support setting up Customer current method as default, because it's not possible to call from client. And to do what you want, you would need to listen to webhook events on server. When a PaymentIntent is confirmed by client, you will receive a payment_intent.succeeded
(Server) Create a PI -> (Client) confirm a PIT -> (Server) listen to webhook, catch the payment_intent.succeeded, take the PaymentMethodId and CustomerId and set as default to the Customer
how to get the paymentmethod_id while creating the payment_intent in the server using flutter stripe
You can't yet, because only after PaymentIntent is confirmed, you will have the PaymentMethod Id
Thanks for the info, when we use flutter stripe package the default payment sheet is showing default payment method in the client but that is not the default payment method in the customer object.
ie the screenshot from the flutter payment sheeet after adding the payment methods. Here client can choose different methods, now while processing the payment in the server we dont have this information as it was only in the client
Is 3155 actually the default payment method? Could you give me the Customer Id for a quick look?
nope by default when we use flutter stripe package it is adding all card payment methods for the customer but none of them selected as default in the stirpe side
default source / invoice default soure all are null by default
so here when we follow this , (Server) Create a PI -> (Client) confirm a PIT -> (Server) listen to webhook, catch the payment_intent.succeeded, take the PaymentMethodId and CustomerId and set as default to the Customer, since we are doing this in the backend how do we know the succeeded payment method is the preferred payment method for the client ?
if we have multiple payment methods
if we can know how this can be done in ios / android also would be good. As I have mentioned earlier, our payment model is going to be exactly like how uber and lyft. if we can know how this can be achieved using stripe and flutter would be great
In the event payment_intent.succeeded you should have only one PaymentMethod which is used to confirmed that PaymentIntent
When you customer has multiple PaymentMethods, he/she still only be able to use 1 of them to confirm a specific PaymentIntent
The logic of listening for webhook is outlined here: https://stripe.com/docs/payments/save-during-payment?platform=ios&ui=payment-sheet#ios-post-payment
ok, so each time when the user change the card in the flutter stripe paymentsheet and they confirm that will trigger webhook which can be indication that user changing their default payment method from the client?
- it will indicates what PaymentMethod they have used from client, and you would want to set that PaymentMethod as default for them, or not. It's up to you as the merchant π
gotit thanks π
In our case we are just onboarding the user with the preferred payment method but no actual payment happening like it mentioned in that article , here is our scenario : https://stripe.com/docs/payments/save-and-reuse
So are we missing that webhook notification and set the payment intent information in that documentation>
Oh so you are using SetupIntent?
yes
Similarly you will have the setup_intent.created which contains the PaymentMethodId
also our payment intent is getting created like this , https://stripe.com/docs/payments/capture-later#authorize-only , that article says the below but not sure how to do it technically, "Before continuing to capture, attach a payment method with card details to the PaymentIntent, and authorize the card by confirming the PaymentIntent. You can do this by setting the payment_method and confirm fields on the PaymentIntent"
if you can help on clarifying that would be helpful too
From both client and server side what we need to do for ""Before continuing to capture, attach a payment method with card details to the PaymentIntent, and authorize the card by confirming the PaymentIntent. You can do this by setting the payment_method and confirm fields on the PaymentIntent"
"
I see, you can simply follow the previous SetupIntent guide (https://stripe.com/docs/payments/save-and-reuse), and from step 5 of "Charge the saved payment method later", you append an extra parameter of capture_method: 'manual' then call the Capture API later
In that step 5, you are (creating + confirming) at the same time, already specifying a Payment Method
Ok thanks, so in step 5, how exactly the server is getting the PAYMENT_METHOD_ID? curl https://api.stripe.com/v1/payment_intents \
-d amount=1099
-d currency=usd
-d customer="{{CUSTOMER_ID}}"
-d payment_method="{{PAYMENT_METHOD_ID}}"
-d off_session=true
-d confirm=true
sorry for my ignorance with all these basic questions as I am brand new to strip SDK π
(please redact your key, this is a public forum)
Within the same guide, before step 4 and 5, on server listen to the setup_intent.created, take the Payment Method Id and Customer Id, then set the PaymentMethod Id as the default payment method. Then in step 5, instead of listing Payment Method Id as the guide says, you can simply find the default one
Aweosome thank you so much, i think that is waht puzzling me π , I think it was not clear in the documentation
Now for the setup intent can you confirm if apple wallet and google pay supported ? https://github.com/flutter-stripe/flutter_stripe/issues/426 , since I couldnt find this information in any stripe documentation it would be great if you can validaet it
also it is clear that we can get this as a paymentmethod in the backend as we are seeing only cards added as a payment_method not apple wallet cards
Yeah good question. You were correct that on backend/webhook we only see the PaymentMethodId, but I have a feeling that SetupIntent wouldn't support those wallet, because SetupIntent is for you to seamlessly charge your customer without their needs to be online, but ApplePay/GooglePay was designed to takes customer's authentication (face/fingerprint) for every payments π€
let me try it
Thank you π
I have tried around, and sorry I think ApplePay/GooglePay isn't compatible with SetupIntent, as mentioned in the issue above πββοΈ
Ok good to know and thanks for the confirmation. Regarding the webhook I am not finding the paymenthod id available with setupintent_created event, I believe we have to use setupintent_succeeded to get the paymentmethod id right ? ref : https://stripe.com/docs/payments/intents?intent=setup#intent-statuses
Sorry my bad! Yes it's setup_intent.succeeded indeed!