#ScottWrkout
1 messages ยท Page 1 of 1 (latest)
๐
Hi there
We are having issues integrating Stripe with Connected accounts. When we create a PaymentIntent using a Connected AccountId, we are unable to load Stripe Elements in order to complete the payment. We get a 404 from the Stripe API trying to retrieve the PaymentIntent. We have confirmed that we are sending the client_secret, and can see that it is part of the request, however we are getting 404's retrieving the object. It seems like maybe an ownership issue of the PaymentIntent? This is being done in test mode.
Sounds like you may not be initializing client-side as the Connected Account
Are you initializing stripe using the Connected Account ID and your platform publishable key?
We are passing the Client ID to the 'loadStripe' javascript function, but I'll have a look at the document.
Yes, we are.
Thanks, looking
That's the request ID for the PI itself, let me find one for the 404
Ok, excellent. The 404's appear to have disappeared from the dashboard on my end.
You have to filter for GET requests
We don't display GET requests by default
That said, it does look like an issue with the key initialization
Interesting. They were showing live yesterday for us.
They don't appear when I filter to GET now, either.
I see the error on your platform account. Example: https://dashboard.stripe.com/test/logs/req_lIKjESaMjmO4UT
Which tries to retrieve pi_3MHu4W4QsoQHum8C0tUydjcY but that PaymentIntent exists on your Connected Account (acct_1MFlc44QsoQHum8C)
Right
That said, the retrieval here is happening server-side
Not client-side
So you need to pass the Stripe Account header server-side to retrieve that
We are trying to set it up such that the money is transacted through the Connected account.
So as we show here: https://stripe.com/docs/connect/authentication#stripe-account-header
Do you have the code for your server-side PaymentIntent retrieval?
Yes -- and we are passing it as such. One moment, I'll paste the code I shared with stripe support.
Sounds good. I have to step away but my colleague will jump in to help!
Your current setup will do this. You are creating the payment intent on the connected account so the funds will go to that account. I actually see you don't have an application fee on these payments so your platform won't get any funds from these payments unless you add them
Understood with respect to the application fee. We are doing this in test mode, so that is not currently a concern.
Awesome, just making sure
Do you do a similar thing with requestOptions when retrieving the payment intent as well? From the call bismark found, it looks like that didn't happen which is why that request returned a 404
We are not requesting the PaymentIntent from our API-side. We are using Stripe Elements, which is where the call is failing.
Do you have a public test page I might be able to look at here?
@waxen atlas -- Can you link Pompey to a test page on staging for this?
That should work
Thank you. Checking out that page
Hang on, Stripe isn't connected on that one
What do pre and post stripe mean there?
Give me a moment!
Gotcha
I think our server is configured to have payments pass through us at the moment; it is working in that capacity. I'll have to update the server to the connected account. One moment.
I created this PI which transacted, however the payment goes through our main account rather than the connected account: pi_3MIHSvGIgUExgoNw0xNiHJqG
That PaymentIntent has the connected account ID attached to it, but the front end loadStripe call is not using the account ID
It looks like you created the payment intent on your platform account rather than the connected account https://dashboard.stripe.com/test/logs/req_E0w5rvM9zkZnJD
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yes, you are correct.
So whatever code ran may not have used that StripeAccount argument
Main branch was out of date for me locally, updating it. We are mid-deploy however, so need to hold off before I can make the change. Are you available for the next bit?
Yeah I'm here for a bit and after that a colleague will swap in who can also help.
Coordinating on our end. Shouldn't take long.
Also to be clear, the call that bismark found earlier was definitely server side, so it looks like somewhere in your code there is a PaymentIntentService().Get() call that does not use this Stripe-Account header either https://dashboard.stripe.com/test/logs/req_lIKjESaMjmO4UT
Can you see the call source? I believe the call is coming from wrkout-st.live which is our front-end.
Oh, that call was made by insomnia -- that was an attempt to retrieve it manually.
Ah okay that makes sense as well, I just saw it came from a .NET call and was just calling that out in case your server-side code had that somewhere
Our internal API only ever calls CreateAsync with respect to payment intents
Ok. Our staging server is updated to use the Account ID, and is returning 404 errors again.
If you select an item, you'll see that Stripe Elements flashes briefly on screen, then disappears and the networking console shows the 404 trying to retrieve the PaymentIntent.
I assume I should try the "post-stripe" option?
Either is fine, the naming is related to internal pricing as opposed to functionality.
Do you have credentials for a test account? It is asking me for a login
If you can DM them to me I can use them
Thank you, it actually turns out @median seal is stepping back in so I passed the credentials back along to them.
Ok
Thanks
K here is the request your frontend is making: https://dashboard.stripe.com/test/logs/req_dNTXXTloZcAgWU
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So yeah, that request is coming from your platform account
And trying to retrieve a PaymentIntent on the Connected Account
So the issue really is the initialization of Stripe on your frontend
However, why are you retrieving the PaymentIntent via a GET request to begin with?
Why not just pass the client secret from server --> client
We are using the JS library and initializing with `loadStripe( [publishable key], { stripeAccount: [client_accountId] });
We are passing the client secret from our API to our front end
The documentation indicates to use the client secret to initialize Stripe Elements, which we are doing. Is there another way we should be loading this?
Can you share your full relevant client-side code here?
@waxen atlas ^
Yes but generally what you do is fetch your server to create the PaymentIntent and then respond to that fetch request with the client-secret
Wait... you must already be doing that
Yes -- our internal API creates the PaymentIntent and returns the Account ID and client secret.
Yeah so where does the GET request come into play here? Like why are you retrieving the PaymentIntent at this point at all?
We are not issuing the GET request anywhere directly -- I believe it is happening when we call Stripe Elements.
Wait, I see something in our code where perhaps we are doing so -- let me investigate. Thank you for pointing that out.
Yeah your code is doing that and it is worth looking into why, however you are still going to run into the same issue when attempting to render Payment Element since you aren't initializing as the Connected Account for some reason. Can you try hard-coding the Connected Account ID into { stripeAccount: [client_accountId] }
We were trying exactly that yesterday. Happy to try it again, though.
Hmm. The point where we attempt a GET is after the return URL, so we aren't reaching that point in our code.
Yeah that can't really be the case... we see the GET request occurring on page load.
Looking at your page more to see if anything jumps out
But if you can share client-side code that would help
Our FE is written in vue/typescript, so we're debugging the generated JS now..
Gotcha. Yeah I'm not able to inspect your frontend code via the Web Dev Console so I can't help too much from here.
The issue really does come down to something preventing the front-end from initializing Stripe as the Connected Account
Will just be figuring out why that isn't happening
I believe the GET request in question is being generated by Stripe Elements when we load it; is there a way for us to pass the Account ID to Stripe Elements when we create the element?
So there are two GET requests, one is generated by Payment Element attempting to be rendered, the other is your code attempting to retrieve the PaymentIntent
Both hit the 404 since Stripe is initialized as the platform but the PaymentIntent is on the Connected Account
That's why I said above that it didn't actually fully matter if you found the source of your own PaymentIntent retrieval, because this other GET request would still fail.
We are currently confirming that we're calling loadStripe with the Connected Account ID
To answer your question, you pass the Account ID when you initialize stripe, not Stripe Elements
And it shows that we are.
Are you willing to share the relevant code?
console.log(stripeAccountId.value); // ''
await generatePaymentIntent(selectedPackage.value, studioUserName.value);
console.log(stripeAccountId.value); // 'acct_1MFlc44QsoQHum8C'
await loadStripe(pubKey, { stripeAccount: stripeAccountId.value });
stripeLoaded.value = true;
And can I see your Elements Provider Component code
<div v-if="stripeLoaded && stripeOptions.clientSecret">
<StripeElements
v-slot="{ elements }"
ref="stripeCheckout"
:test-mode="isStripeTestModeEnabled"
:stripe-key="pubKey"
:elements-options="stripeOptions"
:confirm-params="confirmParams"
>
<StripeElement
ref="payment"
type="payment"
:elements="elements"
:element-options="elementOptions"
/>
</StripeElements>
</div>
Hmm okay what is StripeElements?
That isn't our component
Like you want to be using <Elements />
Above you are awaiting loadStripe but you never actually set that to a variable to pass to your Elements provider stripe prop
So yeah I think there is just an issue here with how you are using our Stripe React.JS library unless I'm missing something?
We have a vue3 app, not react
Ahhh doh you mentioned that above
Sorry
Okay interesting. I'm not very familiar with Vue but let me take a look
Okay so here: const stripeKey = ref('pk_test_xxx') can you try doing const stripeKey = ref('pk_test', { stripeAccount: 'acct_123'})
No I mean with your key/account. But actually I don't think that is going to work.
Let's do a test actually
No -- looking through the github for this VUE component, it reinitializes Stripe in the Elements code they created.
export const initStripe = (key: string, options?: StripeConstructorOptions) => {
try {
if (!window.Stripe) {
throw new Error(ERRORS.STRIPE_NOT_LOADED)
}
const stripeInstance: Stripe = window.Stripe(key, options)
return stripeInstance
} catch (error) {
console.error(error)
return error
}
}
That snippet is in your code or something you are seeing on github?
That's from the component's github -- https://github.com/ectoflow/vue-stripe-js/blob/main/src/stripe-elements.ts
Ah gotcha
Can you do a test with:
console.log("testLog: ", testLog);
stripeLoaded.value = true;```
And lets see what that logs
Okay that's good. We do see _stripeAccount there
Hmm in the Github for Vue I see: ```<StripeElements
v-if="stripeLoaded"
v-slot="{ elements, instance }" // attention: important part!
ref="elms"
:stripe-key="stripeKey"
:instance-options="instanceOptions"
:elements-options="elementsOptions"
I don't see instance in your code?
Not sure what that is, but is there a reason that is missing?
We're literally looking at that on our end right now as well ๐
Looking like we have a winner
That fixed it?
Looking like the payment was made -- our subsequent get to the PI may be failing, but we know why if that's the case.
Thank you so much for your help @median seal , I think this is an us issue now ๐
Glad to hear that you are unblocked!
Don't hesitate to let us know if we can help any further
If you come across other customers using the vue-stripe-js component, you can let them know that StripeElements in that package creates it's own Stripe instance and needs to be configured within the Element initialization!
That's good to know! Might be worth leaving an issue on the github repo suggesting they update the ReadME (or submitting a quick PR to do so).
We don't maintain Vue-stripe-js otherwise I would be more proactive ๐
No worries. We can reach out and let them know about it. I haven't delved their documentation myself to see if it's documented, but either way it's good to have resolved.
Thanks for the great support. Much appreciated from yourself and Pompey.