#knuppi-connectaccount-objects

1 messages ยท Page 1 of 1 (latest)

flint fiberBOT
storm siren
#

HI ๐Ÿ‘‹

untold phoenix
#

Hi @storm siren

#

Please check this request req_K3JUNzISIwOQRF

storm siren
#

I"m going to need much more information to help here.

What is the error they are seeing? How are you creating Payment Intents?

untold phoenix
#

Sorry, we are NOT successful in creating a paymentintent

#

The token ID comes from the mobile app

storm siren
#

The error message is pretty explicit. The token parameter is not valid

untold phoenix
#

Yes, however. We're using your Stripe Google/Apple Pay Flutter package

storm siren
#

Okay, how does that change anything?

untold phoenix
#

I'm a bit lost. When we run this through staging and localhost, then everything is working

storm siren
#

You need to be creating a Payment Method (instead of a token) and using that ID pm_ as the payment_method parameter

untold phoenix
#

We're using stripe_account in all our communication with your API

storm siren
#

That doesn't change this either

#

I'm sorry if it's confusing but you keep bringing up things that have no connection to the error you are seeing

#

What you are attempting to do is to provide a payment method when creating the payment Intent. But you are using a Token ID, which is not valid

#

You need to create a Payment Method and supply it in the payment_method parameter

untold phoenix
#

the token - which is wrong - is generated by your flutter library, am I not correct?

storm siren
#

We dont' have or support a flutter library. That is a third party

untold phoenix
storm siren
#

No

#

Flutterstripe is not us

untold phoenix
#

I'm curious - and this is perhaps outside your purview - but how is the token generated? Do you have an API endpoint for it?

#

Also; is it possible to read change logs for your APIs?

#

Need to understand why a token is generated when it's faulty. I mean, It shouldn't be generated at all if it's wrong/broken

storm siren
#

Even when using the Tokens API, it will create a different type of ID for each type of payment method

#

For example, if you use the Tokens API to create a Credit Card payment method it will have an ID with card_

untold phoenix
#

What is the suggested approach when creating PaymentIntents now?

#

During testing, we've been using "token": "pm_card_visa", and then the flutter_stripe package to use it in production

storm siren
#

Yes that works because It's a Payment Method, not a Token or a Card

#

Payment Intents are designed to work with Payment Methods

#

Since we don't own and control flutterstripe, I don't have insight into how that package is confgured. but I would imagine there are ways to create payment methods instead of tokens

untold phoenix
#
        if self.token and not settings.DEBUG:
            intent_kwargs |= {
                "payment_method_data": {
                    "type": "card",
                    "card": {"token": self.token},
                },
            }

        return stripe.PaymentIntent.create(**intent_kwargs)

this worked until recently, and it seems that there may be some problem between stripe_flutter and your API?

storm siren
#

When you say "this worked" do you have any example requests where it was successful?

untold phoenix
#

Do you see anything weird/odd?

storm siren
#

OH!

#

Sorry for the delay. I see the problem now

#

๐Ÿคฆโ€โ™‚๏ธ

#

The issue is that this request that failed is a Direct Charge. This means that the payment method represented by that Token ID and the Customer both need to exist on the Connected Acount

#

But that is not the case here.

untold phoenix
#

Oh, could you explain a bit further?

#

The customer, are they not connected to the Account?

storm siren
#

No they are not

#

The Connected Account is acct_1NvFsKQ6t7QQwXAB, But the Token exists on account acct_1MRCHrL8luXqMHtb . So even though the Customer exists on the Connected Account, the Token does not

untold phoenix
#

which Account does cus_PdMJiCRVUw2Mgn belong to?

flint fiberBOT
storm siren
#

The Connected Account

untold phoenix
#

This is what I see in our server logs as well

storm siren
#

No it should not, because the Token does not belong to that Customer or Account

untold phoenix
#

Ooooh! So when the Token is created, it has to be called with stripe_account=acct_1NvFsKQ6t7QQwXAB in the header - correct?

storm siren
#

Correct

untold phoenix
#

Can you please verify that the stripe_account is missing from the Token generation call? (like, if you check the token and check its history?)

storm siren
#

This is something you can and should verify yourself

#

But let me check

untold phoenix
#

Your (very good) search field doesn't give me any results.

Thank you for checking!

storm siren
#

The token request was made with the account header for acct_1MRCHrL8luXqMHtb

#

So you will need to review the workflow for your application to make sure it keeps the correct Stripe Account header for all related requests.

untold phoenix
#

Can you give me the name of the Account with acct_1MRCHrL8luXqMHtb?

storm siren
#

Sorry no. This is something you will need to look up via the API.

#

And pleae do not share those names here

untold phoenix
#

OK, so if I'm correct we must make sure that the stripe_account-header is correct when requesting the token and that should fix everything?

storm siren
#

Correct, that is what I am gathering from these API requests

#

You will want to make sure you are using the same stripe_account header value for all the calls that should be occurring on the same account

untold phoenix
#

Yes, absolutely correct!

storm siren
#

Great! Hopefully ๐Ÿคž that has resolved your issue

untold phoenix
#

You've absolutely pointed me in the right direction ๐Ÿ˜…

storm siren
#

Happy to help ๐Ÿ™‚

#

I'm going to close this thread but if you wind up having more questions about your integration you are welcome to post again in the #dev-help channel ๐Ÿ‘‹