#serhiy-lv_api

1 messages Β· Page 1 of 1 (latest)

thick cairnBOT
#

πŸ‘‹ Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1250039779706540125

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

meager yew
#

@fallen elm our previous thread was closed. Can you catch up with us here?

#

We've enabled also tax for the account: acct_1PQS2LHOgBsfft6i

deft cipher
#

here is a request we are making:

curl --location 'https://api.stripe.com/v1/tax/calculations'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'Authorization: Bearer sk_test_51PQS4dBAqQmLHpv8mUtQAzXESdxv4WTuHeAi5gdUx1Guah3m2ub759b8wdyBGarO8yOn0PlsmN16EafKScQqYO3w008DIlWQsm'
--header 'Cookie: __stripe_orig_props=%7B%22referrer%22%3A%22%22%2C%22landing%22%3A%22https%3A%2F%2Fdashboard.stripe.com%2Facct_1PQ4xbAoSN5FqK2L%2Ftest%2Flogs%2Freq_ja04M6XNTPf1jz%3Ft%3D1718035660%22%7D; cid=109c3ac3-5be3-425d-8512-7eb6c0131d3e; machine_identifier=fKsBuH31HWkgsomgxnfPdVqjz%2Bvl2H8OtgIY8gZCYXQtRGn3lMu%2B93sWjPb1yDs9T5w%3D; private_machine_identifier=DOMWImUEwdEz4rUgq8Ccps6sV1OgZObdFBfeesIDUPJzFTNXBwyLB73SsK8xH6D4b4Y%3D; stripe.csrf=5a40y5B-zK4H42ZXf8tI8Icyyq3WpqtLfgjzjZEZfqUre_fdsl0VoVseKcszCRTSAhS39e5IXvl_nP96zhCcgzw-AYTZVJx5wkESwwVbN70md6wm4yVimYqUUtjxuVQSCMmbCCzlJg%3D%3D'
--data-urlencode 'currency=USD'
--data-urlencode 'line_items%5B0%5D%5Bamount%5D=10'
--data-urlencode 'line_items%5B0%5D%5Bquantity%5D=1'
--data-urlencode 'line_items%5B0%5D%5Breference%5D=test product 3'
--data-urlencode 'line_items%5B0%5D%5Btax_behavior%5D=inclusive'
--data-urlencode 'line_items%5B0%5D%5Btax_code%5D=txcd_99999999'
--data-urlencode 'customer_details%5Baddress%5D%5Bcountry%5D=US'
--data-urlencode 'customer_details%5Baddress%5D%5Bcity%5D=Seattle'
--data-urlencode 'customer_details%5Baddress%5D%5Bline1%5D=920 5th Ave'
--data-urlencode 'customer_details%5Baddress%5D%5Bpostal_code%5D=98104'
--data-urlencode 'customer_details%5Baddress%5D%5Bstate%5D=WA'
--data-urlencode 'customer_details%5Baddress_source%5D=shipping'

misty crown
deft cipher
misty crown
#

Yes, we can see all those details from the req_xxx. No need to dump everyting

deft cipher
#

ok

misty crown
#

Taking a look anyway

meager yew
#

@misty crown we would like to provide tax calculation s in the Checkout for a ecommerce System like Shopify, so we were following "Tax for software platforms"

misty crown
meager yew
#

@misty crown wait a second. acct_1PQS2LHOgBsfft6i is the new account we've just created that is acting like a "merchant" account, and for this account we've enabled the tax settings and registered a location. We've performed with this account an Oauth flow and received a token back

#

Where is this id coming from acct_1PQS4dBAqQmLHpv8 ?

misty crown
#

From req_WoE5QC5cA2hlmC that you shared, the request that errors

meager yew
#

Cany ou check based on the token to which account this is assigned?

misty crown
#

acct_1PQS2LHOgBsfft6i has Stirpe Tax activated. But you haven't shared an error for a request on that account

#

Which token?

thick cairnBOT
deft cipher
#

sk_test_51PQ3niFCMR2CSvcskvP5wbJZnFAXJng5obI5akmb8bWeaTbDq3UwNHpQxr7ZKrYu3xttFsnT6YVD1HM56uZ06KW500DwyV4ZB5

meager yew
#

this is the token we're using in the request Authorization header

#

we got this token back from the new account we run the Oauth flow with

misty crown
#

Yep, it's for acct_1PQS4dBAqQmLHpv8

#

Not acct_1PQS2LHOgBsfft6i as you expect. You need to generate a new OAuth token

meager yew
#

can you let me know to which email acct_1PQS4dBAqQmLHpv8 this is assigned to?

misty crown
#

None, there wasn't one provided

meager yew
#

We have basically two accounts: Platform Account A (we get the connect client id there, and the api secret) and Merchant Account B (the one that we're using to call the Oauth URL acct_1PQS2LHOgBsfft6i ), at the end of the Oauth flow we're getting back a token, which we assum is for account: acct_1PQS2LHOgBsfft6i because this account clicked the "Connect" button

misty crown
#

Well clearly you're complete the OAuth onboarding flow signed in to acct_1PQS4dBAqQmLHpv8

#

Overall, you shouldn't be using OAuth anyway

meager yew
#

?

#

We don't want to have a 1:1 connection, we need a 1:n connection

#

This use case needs to be implemented

#

So there are a lot of merchants that should be able to see Tax rates coming from their connected Stripe account in the checkout

#

In order to achieve this, they should connect their stripe accounts

misty crown
meager yew
#

and how if not via OAuth2 ?

misty crown
#

In any case, the error you're seeing is because the secret key you're using was generated for an account that does not have Stripe Tax activated

I suspect when you've followed the OAuth onboaridng URL you've been authenticated into a different Stripe account then what you expected

#

You either:

  • Enable Stripe Tax on acct_1PQS4dBAqQmLHpv8
  • Re-generate a token/key for acct_1PQS2LHOgBsfft6i and use that
meager yew
#

We've tripple check and saw the email address of the new merchant account we've created

deft cipher
#

here is an account we are connecting:

misty crown
#

The email address is not unique. A Stripe sign in can have multiple accounts (acct_xxx)

#

So that's not a reliable way to identify accounts

meager yew
#

well, it's just following the flow we're seeing πŸ™‚

misty crown
#

If you use the Account Link method, then you created the Account object (acct_xxx) upfront and then onboard it directly

meager yew
#

there's not a lot we can configure

misty crown
#

The OAuth method will either use an existing acct_xxx if the email/user has one (they can select in that dropdown) or will genertae you one as part of the flow

misty crown
meager yew
#

@misty crown but if we just created a complete new account with one email address how can this become a problem? I mean there is nothing else to match and no sub-accounts added and even if I would have subaccounts I'd expect that the system is requesting for which subaccount i want to grant access

misty crown
#

I don't understand what you're asking me

#

but if we just created a complete new account with one email address how can this become a problem?
Created where? The issue is whoever onboarded the account had an existing Dashboard session with a sign in. If they use an OAuth link, then they can onboard to the platform that created the OAuth link using any number of the accounts accessible under their Stripe account

#

This is the advantage of Account Links – you explicitly create the Account and use the returned acct_xxx with the Account Link so you know you're explicitly onboarding that account. Then you can make API requests using your platform secret key, and passing the connected account ID in the headers: https://docs.stripe.com/connect/authentication

Learn how to add the right information to your API calls so you can make calls for your connected accounts.

deft cipher
#

we created a new account in other browser and initated oauthFlow from there
there is no possiblity for sessions intersections

misty crown
#

You keep saying 'created a new account'

#

How? Via the Dashboard menu?

meager yew
#

No

#

We've opened another browser, went to stripe.com and created a new account

misty crown
#

Well however you generated the key, it was not with the account you think it was

meager yew
#

after that we've clicked on the Connect button to initaite the Oauth flow and ended up on

#

What happens if one clicks on "Skip this form" ?

#

Does that has any effect on the OAuth2 flow?

misty crown
#

As I said, OAuth is not recommended anyway. It's deprecated:

OAuth is not recommended for new Connect platforms. We recommend using Connect Onboarding for Standard accounts instead.

#

When onboarding standard accounts, we'l create a new acct_xxx that is for the sole purpose of the connection to the platform. Which is why it doesn't match the ID you have from the Dashboard

meager yew
#

Thanks, we're going to check this

meager yew
#

@misty crown we've added 2FA to the new account and now when we're running the OAuth flow we're seeing an account that we can select, and in the end the flow is working

misty crown
#

You're all set then?

#

I'd strongly recommend migrating to the Account Links onboarding flow

meager yew
#

Well, I'm not sure if we're all set then πŸ™‚ It's seems a lot inconsistent in terms of onboarding with OAuth2 (for whatever reasons). Well, we're enforced to migrate