#noah_code

1 messages · Page 1 of 1 (latest)

rugged cobaltBOT
#

👋 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/1392681517855277189

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

plain oasis
#

hello! Can you share with me the PaymentIntent id so that I can take a closer look?

brittle niche
#

Hey!

sorry i might be a bit slow, i have not created payment intents but created setup intents

basically i create setup intent on behalf of connected account, but when i try to confirm it, i get the logs in my platform account

here is the latest setup intent id: seti_1Rj9M5QO1kAloiEr50MqUEtV

if this is not what you are looking for, what should i try?

edit: this is the issue i am having https://github.com/stripe/stripe-react-native/issues/1709 (but i am on web not native)

plain oasis
#

so you are wondering why the SetupIntent is created on your platform account and not the connected account?

brittle niche
#

wondering why the setup intent is trying to be confirmed on platform when it was created on connected account

the stripe promise also uses the connected account:

const stripePromise = loadStripe(STRIPE_PUBLISHABLE_KEY, {
stripeAccount: account.accountId,
});

which is passed down:
<Elements
stripe={stripePromise}
options={{
mode: 'setup',
currency: 'cad',
onBehalfOf: account.accountId,
setupFutureUsage: 'off_session',
appearance,
}}

<CheckoutForm />
</Elements>

#

intent is created correctly, its just that when confirming after a user has inputted their billing details, it confirms it on platform instead of connected account which causes it to say Message: "No such setupintent: 'seti_1PmBVYRtBFCjzLBfZ*******'"

plain oasis
#

aaaah, okay i get the problem now

#

you would want to include the StripeAccount client side also. But, I see from your code that you are including the stripeAccount. Can you verify if your STRIPE_PUBLISHABLE_KEY is of the platform, and the stripeAccount is that of the correct connected account?

brittle niche
#

yep, the PK is from platform, and stripeAccount is from connected account

i pass the promise to the Elements component

then in the child i use const stripe = useStripe(); which is from @stripe/react-stripe-js

i have done everything in the docs from the link you have sent, but i am still sure i am doing something wrong lol

plain oasis
#

can you try to find the request id for this error message in your Dashboard : "No such setupintent: 'seti_1PmBVYRtBFCjzLBfZ***'", or possibly from the network logs in your developer tools. With that, I can look closer at what is the issue

#

the request id starts with req_

brittle niche
#

req_9KfqZ7tqKyvmfh

#

^ that is for: seti_1Rj9s2QO1kAloiErjIU2zDr8

plain oasis
#

that's the creation

#

i need the request id for the attempt to confirm

brittle niche
#

ah mb

#

creation:

  • seti_1Rj9wNQO1kAloiEr0uf6UWdi
  • req_5wupdlz2yZuZF0

confirm:

  • seti_1Rj9wNQO1kAloiEr0uf6UWdi
  • req_qjSX9LfE7oCnqT
plain oasis
#

great! gimme a few mins!

brittle niche
#

will do - appreciate the help

plain oasis
#

so when i look at the confirmation request, the StripeAccount header is not used

#

in essence stripeAccount: account.accountId, -> this must be set to that of the connected account

brittle niche
#

yep, i am doing that

or do i need to specify it somewhere else too

i am specifying it in:

  • customer creation
  • set up intent creation
  • and client side stripe promise which is passed to Elements component
plain oasis
#

no, that's not the StripeAccount header

brittle niche
#

const confirmSetup = await stripe.confirmSetup({
elements: elements!,
clientSecret,
confirmParams: {
return_url: 'https://localhost:3000/booking/aleems-shop-3?success=true',
},
});

^^ this is the confirm

i cannot see in the types that i can pass the connected account like in other ones

brittle niche
plain oasis
#

that's on_behalf_of which is a totally different parameter

brittle niche
#

how do i add the header?

and where

#

is this incorrect (edit: i know it has the ? but it exists, just forgot to rm it)

plain oasis
#

can you do a log to confirm that it's actually set, and what is the accountId that you're actually passing in?

brittle niche
#

after logging the promise too

plain oasis
#

maybe try removing on_behalf_of first. You should not be using on_behalf_of with a direct charge actually

brittle niche
#

thing is i am not using it anywhere, and also restarted dev server multiple times to make sure

#

sike, i am using it somwehre

#

removed, but still same

plain oasis
#

i feel like your old code is likely still being cached somewhere, or you pushed the new code but it's not deployed yet, etc

brittle niche
#

hmm, okay ill cleare cache etc

this is all on local dev though

plain oasis
#

i think it's difficult for me to help with this because it seems like your old code is still being used despite you changing it

brittle niche
#

but after removing the onBehalfOf

it is no longer showing in the latest logs:

#

or do you think the old code is still being used, apologies for this long ticket

plain oasis
#

are you still running into the same issue after removing the onBehalfOf?

brittle niche
#

yea the same issue still happens, still says no such setupintent

#

req_k3sXZIA6SPqoTb if needed

plain oasis
#

the stripeAccount header is still missing

brittle niche
#

🥲

plain oasis
#

your code looks correct to me. I think i'm going to need you to share with me a simple example that reproduces the issue

#

ideally using a third party service like codeSandbox

brittle niche
#

hmm, okay i will try

brittle niche
#

found the issue bruhh

#

but dont know what caused it

#

i load stripe in parent, pass it in <Elements

#

then in <CheckoutForm />

i listen to docs and do:
import { useElements, useStripe } from '@stripe/react-stripe-js';

const stripe = useStripe();
const elements = useElements();

but when i do:
console.log('stripe', stripe);

const confirmSetup = await stripe.confirmSetup({
elements: elements!,
clientSecret,
confirmParams: {
return_url: 'https://localhost:3000/booking/aleems-shop-3?success=true',
},
});
console.log('confirmSetup', confirmSetup);

the stripe log does not have _stripeAccount 95804pepecrya

#

but it is the same instance, but does not have it when passed down?

#

95804pepecrya fixed it

#

i was stupid and created stripe instance inside the component so it re-rendered and lost the account

#

sigh - apologies for wasting all this time