#xephox-connect-paymentelement

1 messages ยท Page 1 of 1 (latest)

viral craterBOT
pseudo pollen
#

Hi there! What's FE in this case? What kind of request are you making when you receive this error?

humble fern
#

oh sorry, Front End. I am trying to use stripe react elements from react-stripe-js package to show a save card portal on my web application. But On passing the stripe publishable key, I get this error

#

I am kind of sure that I am using a connected accounts publishable key here

#

I was wondering if there were anything other than not using a connected account that could trigger this error message?

pseudo pollen
#

Hmmm

#

Do you have the connected account ID, or do you have a request ID for your request to create a SetupIntent?

humble fern
#

one sec

#

here acct_1NBP4pGbrA47duwb this is the account id

pseudo pollen
#

This is a standard account, created by a platform in test mode. It's connected to the platform.

humble fern
#

oh is this not a connect acount?

pseudo pollen
#

It is, but it's of "standard" type

humble fern
#

whats the difference and what account do i need it to be

pseudo pollen
humble fern
#

oh

#

just quick question, od you know the type of account that just takes the publishable key, setup_intent ?

pseudo pollen
#

If you're creating a charge on a platform account, or if you've created a standalone standard account on stripe.com (no Connect involved)

humble fern
#

alright, final question, could you tell me what type of account this is acct_1Mo7yyQcZzljEnGz ?

pseudo pollen
#

This is also a standard connected account, controlled/owned by the same platform as the one above

viral craterBOT
humble fern
#

but for the above one i can just use the stripe publishable key, stripe account and client secret

#

why is this not working for the first account id?

humble fern
#

I am using the same method to access both account details

  <Elements stripe={stripePromise} options={options}>
      <AddCardForm hashedId={setupIntent.payment_id} />
    </Elements>

But for the first account id I get an error

strange quartz
#

๐Ÿ‘‹ what exact error do you pass? What's the problem in details?

#

xephox-connect-paymentelement

humble fern
#

oh sorry, lemme summerize

strange quartz
#

I read the thread, just all you said is that it works with one and not the other and that's it

humble fern
#

Yeah pretty much, I am trying to debug this to figure out whats wrong here

strange quartz
#

Sure, but to help you I would need more specific information like exact code, exact error, where the error happens, etc.

humble fern
#

cool, give me a second

#

On the front end, I am trying to show a add card page, and I am using the code below to get this result

 const options = {
    appearance,
    clientSecret: setupIntent?.client_secret,
    metadata: { hashed_id: setupIntent.payment_id },
  };

const stripePromise = loadStripe(stripePublishableKey || "", {
    stripeAccount: setupIntent?.stripe_account,
  });

<Elements stripe={stripePromise} options={options}>
      <AddCardForm hashedId={setupIntent.payment_id} />
    </Elements>
strange quartz
#

Can you give me an example PaymentIntent + account id where it doesn't work?

humble fern
#

for the account id : acct_1NBP4pGbrA47duwb
i get the following error:

  "error": {
    "code": "platform_account_required",
    "doc_url": "https://stripe.com/docs/error-codes/platform-account-required",
    "message": "Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.",
    "type": "invalid_request_error"
  }
}```
#

i can get you a setup intent, does that work?

#

I do not get this error for this account : acct_1Mo7yyQcZzljEnGz

strange quartz
#

SetupIntent works fine, I need both that id and the associated account id

humble fern
#

seti_1NDZ78QcZzljEnGz1VBoA1Sy_secret_NzYDjNvHONSfiQ2aGZhiYzn524NNkrO this is the setup intent

#

what is the associated account id?

strange quartz
#

Ah sorry, this is quite crucial for you to understand. You seem to act as a platform. You have your own API key and you have connected accounts that you want to create Direct Charges on, is that not the case?

humble fern
#

oh sorry, we do have connected accounts that have customers. My intention here is to get card details and add a card to these customers.

#

I don't want to charge anything

strange quartz
#

Yes sorry, just we have our own vocabulary that is quite fundamental to get right, especially as a platform

#

But okay, you have a SetupIntent, you created it directly on the connected account. Then what? What do you do client-side? What's the exact error you get?

humble fern
# humble fern On the front end, I am trying to show a add card page, and I am using the code b...

After getting the setup intent, we run this code:
` const options = {
appearance,
clientSecret: data?.client_secret,
metadata: { hashed_id: setupIntent.payment_id },
};

const stripePromise = loadStripe(stripePublishableKey || "", {
stripeAccount: data?.stripe_account,
});

<Elements stripe={stripePromise} options={options}>
<AddCardForm hashedId={setupIntent.payment_id} />
</Elements> The add card form component has these stripe elements in it( in the pic ). and the error is :{
"error": {
"code": "platform_account_required",
"doc_url": "https://stripe.com/docs/error-codes/platform-account-required",
"message": "Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.",
"type": "invalid_request_error"
}
}`
Basically, I use the setupintent to make the add card from

#

does that help?

strange quartz
#

a little bit

#

what exact part of the code is throwing that error? And what exact id are you passing in data?.stripe_account,?

humble fern
#

its this account acct_1Mo7yyQcZzljEnGz

#

and setupintent is : seti_1NDZ78QcZzljEnGz1VBoA1Sy_secret_NzYDjNvHONSfiQ2aGZhiYzn524NNkrO

#

status code 403

#

with the above error msg as response

#

I think some part of the PaymentElement and AddressElement component from react-stripe-js library is throwing the error

strange quartz
#

your client secret is completely different from the one you shared in that request URL

#

you seem to be mixing up your ids/secret somewhere

humble fern
#

ah sorry, i just reloaded it, this is the new one,
setup intent : seti_1NDaF0GbrA47duwb9oTkclkZ_secret_NzZNDpfZHmswbVYWpFqn5Jr8oljgK75

strange quartz
#

sorry you each time only give me 1% of the info ๐Ÿ™‚

#

Try and give me all actionable things at once. If you look closely the account id acct_123 and the client secret seti_ABC_XXX are in the URL above and they have to match

humble fern
#

yeah very sorry about this, give me second, I juggling multiple things here

#

sorry about this, again but here is a matching one,

"client_secret":"seti_1NDbpEGbrA47duwb1soZYLpT_secret_Nzb1n4hvBeFHputVcRZLGMNU4Sso7q6","stripe_account":"acct_1NBP4pGbrA47duwb"

strange quartz
#

yeah unfortunately I don't understand what the problem is then and I still need a lot more details. Is there any way for me to reproduce somewhere so that I can look at it?

humble fern
#

shoot

#

yeah, lemme try to fix this again on my end, I am as confused as you are as I didn't work on this lol. Anyways, I'll ping here if I need anything. Thanks for the help! sorry for taking up your time.

strange quartz
#

@humble fern there's no way for me to just view it live somewhere for a few minutes? ngrok link could work for example

#

also curious if you get the same error without the AddressElement though it shouldn't

#

oh wait I see it

#

the API key you use is wrong

#

pk_test_51NAmyHJfUIHb6mUZcnr6lMJQHNymuuiaBi9JPsrLZwcyBOJ3U14gLLKX7d40FuQre5uptk7HaVWptw14cuNTL88V00rTMHg5U6 that's what I see in your request URL earlier, that's from a different Stripe account that isn't a platform

#

that's your bug, I was too focused on the SetupIntent + connected account id and I didn't think to check the API key

humble fern
#

so is this not a connected account from our platform ?

strange quartz
#

no

humble fern
#

oh I see

#

I am working this out for a client, so I cannot confirm this, is it possible for you to check if this account's ( acct_1NBP4pGbrA47duwb ) test publishable key is ``` pk_test_51NAmyHJfUIHb6mUZcnr6lMJQHNymuuiaBi9JPsrLZwcyBOJ3U14gLLKX7d40FuQre5uptk7HaVWptw14cuNTL88V00rTMHg5U6

strange quartz
#

no

#

Sorry, no that key is not for that account

viral craterBOT
strange quartz
#

so you seem to be mixing up the Publishable API keys somewhere. but I can't really give you more information than this

#

Right now that API key is for a separate Stripe account that is not a Connect platform and not connected to any platform, so that's your mixup

humble fern
#

Thanks a bunch, this helps a lot

strange quartz
#

Once you use the correct Publishable API key from the platform you should be all set

#

and if you say it works for one account and not the other, properly log the API key and you should see the problem

humble fern
#

Yeah this is actually very helpful

#

Thanks a lot! I had no way to confirm the above thing leading to confusion. Thanks again!