#water_connect-flutter

1 messages ยท Page 1 of 1 (latest)

proud ginkgoBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1242151464940470292

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

obsidian zealot
#

HI ๐Ÿ‘‹

How are you confirming the payment intent on the client side?

unborn chasm
#

Hello! I am.

#

with this api and the client secret from the payment intent

obsidian zealot
#

Can you share the ID of a recent payment intent?

unborn chasm
#

pi_3PIYb7DWqhThyRBI1gelZbh5_secret_KaMWBCfN6uCPW7KxyVi4ebGRM

obsidian zealot
#

This payment intent has never been confirmed

unborn chasm
#

Oh, hmm

#

I am not able to confirm it because when I try, I get an error similar to '
StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: No such payment_intent: 'pi_3PIS7fARUK8clFmp03r4TmO0', message: No such payment_intent: 'pi_3PIS7fARUK8clFmp03r4TmO0', stripeErrorCode: resource_missing, declineCode:
null
, type: invalid_request_error))'

#

It is because I don't have a payment method attached to the payment intent right? How do I attach Google Pay payment method when creating the payment intent?

obsidian zealot
#

The no such [Object] error messages usually mean you are using Stripe Connect and you are attempting to access or manipluate a record that belongs on one account and your request is coming from a different account

#

Are you using flutter_stripe?

unborn chasm
#

Yes.

obsidian zealot
#

I think flutter_stripe must have something like this available

unborn chasm
#

A bit more context, I am making a payment as a Stripe customer connected to a Stripe account (belonging to a third party). so I want the payment from the customer to be applied to the account the customer is added to. Are you saying we need to initialize the mobile app with the Stripe account if we want to make a payment through the customer?

obsidian zealot
#

Yes

#

You created the Payment Intent on a Connected Account

#

You can only confirm the Payment Intent for the same Connected Account

unborn chasm
#

Let me confirm this: I am logging in as a Stripe customer and I want to make a payment through Google Pay, I want this payment to be applied to the Stipe account to which I am added as a customer to. I make a payment > Flutter makes a request to the backend > the backend returns a payment intent > then I confirm the intent. Doesn't data about Google Pay need to also be applied when creating a payment intent?

#

When I log the payment intent created in the backend, it says "status: requires_payment_method"

#

I can see the payment intent for the Stripe account in the Stripe developer logs, so I know it was applied to the Stripe Account, but if I do need to attach the payment method data, how do I attach it? I attached an initial screenshot of my api call.

obsidian zealot
#

When you confirm the intent, your flutter_stripe library will only be able to confirm the payment intent if it has been initialized with the stripe account the payment intent has been created for. Please review the docs I shared and see if flutter_stripe has a similar feature.

proud ginkgoBOT
unborn chasm
#

But there may different Stripe Customers that log in that are attached to different Stripe Accounts in our app, would a solution be when a user logs in and we are able to retrieve the Stripe Account they are connected to, the app needs to re-initialize with the Stripe Account?

#

Can I bypass the initialization requirement by passing the confirm: true parameter in the API call to create a payment intent?

spring horizon
#

@unborn chasm It really depends what you are trying to do. If a Customer pays you for a service you should know who they are paying for that service and initialize the SDK based on that information

#

water_connect-flutter

unborn chasm
#

So the flutter app can't confirm the pi on its' end without being initialized with the Stripe Account the pi is for. If I pass the confirm parameter when I make the pi in our backend, I don't need to send the pi back to the user for the user to confirm it correct? That means I don't need to initialize the application with the stripe account at all right?

spring horizon
#

How are you going to confirm the PaymentIntent on your server? You need a PaymentMethod for that to work

unborn chasm
#

So Google Pay needs to be added as a Payment Method for the Stripe Customer before it can be confirmed?

spring horizon
#

Yes and no. Yes you need a PaymentMethod to confirm that PaymentIntent such as a card or ACH Debit or GooglePay based on what you support.
No you can't just "add it to a Customer" that won't really work or make sense

So really you have to create the PaymentIntent on the right connected account based on who is providing the service and then confirm it client-side after having initialized the SDK with the same connected account.

unborn chasm
#

So when a Stripe Customer logs into our app, we need to retrieve the Stripe Account they are connected to and reinitialize the app so the PI can both be created and confirmed on the connected Stripe Account of the Stripe Customer?

We have a web version of our payment portal that allows Stripe Customers to select a Payment Method that they have added to make a payment to the Stripe Account they are connected to, but this uses tokens and the deprecated Charge API, isn't there a way we can do the same with Google Pay?

spring horizon
#

I'm sorry I'm really struggling to follow what you described. Why would a Customer (person paying) be associated to any Stripe account (person receiving money for the service/product they offer)?

unborn chasm
#

Our Stripe account has multiple Connected Stripe Account, each of those Connected Stripe Accounts have their own Customers

spring horizon
#

Okay so yeah in that case you remember that cus_ABC is on connected account acct_123 and you make sure to always create PaymentIntents on that account and to initialize the SDK client-side with that connected account id

unborn chasm
#

Ok, when I make a PI, how do I attach Google Pay to it? Using a test Customer's added payment method card, I can create and confirm a PI on the server, how can I do this with Google Pay, can a Customer add Google Pay as a payment method like with cards/bank accounts?

#

the stripeAccount field is the Connected Stripe Account that the Customer belongs to

spring horizon
#

GooglePay is just a normal card so it works exactly the same

#

But really you're doing a lot of this mostly wrong. You are not supposed to pass payment_method: 'card_123' at all server-side. You are supposed to show the UI client-side to collect card details again from scratch. It's required for GooglePay

unborn chasm
#

Once the card details are collected from the client-side for Google Pay, what needs to be passed to the server that will create the PI? What parameters do I need to include when I call
await stripe.paymentIntents.create() ?

#

Also, are the card details for Google Pay collected on the frontend? Currently on our web version that uses the deprecated Charge API, we use the card-element to tokenize the card and create a charge with that token.

spring horizon
#

yeah sorry the vocabulary is really crucial here and you are using it a bit differently than we would. Not your fault a lot has changed over the past 6 years since PaymentIntent was introduced and you use an even older integration path.

#

So the first step is: what exactly are you doing client-side? What exact id do you get? Because card_123 is from 6+ years ago.

unborn chasm
#

The current user flow is, the user clicks on Google or Apple Pay, the server will then create a PI and return the client secret key, the client will create a card token using the cardFromToken method from the stripe_flutter plugin and then confirm the payment using the confirmPayment method from the stripe_flutter plugin

spring horizon
#

okay then yeah keep doing that, that's the best approach

unborn chasm
#

Would our flutter app still need to be re-initialized with the Stripe Account that the Customer is connected to when the Customer logs in into our app?

spring horizon
#

I don't really get what "re-initialized" mean. Why wouldn't you initialize when the Customer logs in exactly?

unborn chasm
#

So when a user logins into our app, we will take the user's connected Stripe Account and use that to initialize the Stripe SDK?

spring horizon
#

yes

unborn chasm
#

Can you confirm the parameters that need to be passed when the server creates the PI that needs to be sent back to the client for Google/Apple Pay?
amount ,currency, and the Connected Stripe Account that the customer belongs to, what else?

spring horizon
#

You should not be passing payment_method not confirm: true at all

stable fiberBOT
spring horizon
#

I have to run but @winged sable is taking over!

unborn chasm
#

Appreciate it. I will reply in a bit.

#

So to make a payment method for Google/Apple Pay, the needed parameters are amount ,currency, payment_method_types: ['card'], and I also need to include the Connected Stripe account of the Customer as seen in the screenshot?

winged sable
#

I think you should still include the customer ID cus_.... Otherwise the payments won't be tied to your connected account's existing customer

unborn chasm
#

Hang on, getting a teams call. I'll circle back, apologies for that.

unborn chasm
#

Could not including customerID in the PI be the cause of the error I got earlier? This is the primary reason for the support ticket. This error is gotten after the Flutter client attempts to confirm the PI

StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: No such payment_intent: 'pi_3PIS7fARUK8clFmp03r4TmO0', message: No such payment_intent: 'pi_3PIS7fARUK8clFmp03r4TmO0', stripeErrorCode: resource_missing, declineCode: null, type: invalid_request_error))

#

Or is it only because we did not initialize the Stripe SDK with the Connected Stripe Account of the Stripe Customer when we tried to confirm the PI

winged sable
#

The error message says "No such payment_intent". Looking at that payment intent, I see that you created it on your connected account, it sounds like your client is still trying to confirm the intent as your platform.

#

The customer ID is not relevant to the error, I was just mentioning that because I assumed you have other stuff that works with Customers

#

Stripe objects are only accessible by the account that created them. When you provide that stripeAccount parameter in your server-side call, you indicate that you are making calls as that connected account. So for your client to be able to confirm the intent, it needs to be initialized to make calls as that connected account.

winged sable
#

@unborn chasm are you still looking in to this?