#ScottWrkout

1 messages ยท Page 1 of 1 (latest)

tardy viperBOT
median seal
#

๐Ÿ‘‹

boreal shell
#

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.

median seal
#

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?

boreal shell
#

We are passing the Client ID to the 'loadStripe' javascript function, but I'll have a look at the document.

#

Yes, we are.

median seal
#

Ah okay

#

Can you provide a request ID for one of these 404s?

boreal shell
#

Sure thing. One moment.

#

pi_3MHuCt4QsoQHum8C0ibtwLEa

median seal
#

Thanks, looking

boreal shell
#

That's the request ID for the PI itself, let me find one for the 404

median seal
#

I found one

#

No worries

boreal shell
#

Ok, excellent. The 404's appear to have disappeared from the dashboard on my end.

median seal
#

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

boreal shell
#

Interesting. They were showing live yesterday for us.

#

They don't appear when I filter to GET now, either.

median seal
boreal shell
#

Not a big concern since you've found one.

#

Yes, that's one of the requests.

median seal
#

Which tries to retrieve pi_3MHu4W4QsoQHum8C0tUydjcY but that PaymentIntent exists on your Connected Account (acct_1MFlc44QsoQHum8C)

boreal shell
#

Right

median seal
#

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

boreal shell
#

We are trying to set it up such that the money is transacted through the Connected account.

median seal
#

Do you have the code for your server-side PaymentIntent retrieval?

boreal shell
#

Yes -- and we are passing it as such. One moment, I'll paste the code I shared with stripe support.

median seal
#

Sounds good. I have to step away but my colleague will jump in to help!

boreal shell
cyan bane
boreal shell
#

Understood with respect to the application fee. We are doing this in test mode, so that is not currently a concern.

cyan bane
#

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

boreal shell
#

We are not requesting the PaymentIntent from our API-side. We are using Stripe Elements, which is where the call is failing.

cyan bane
#

Do you have a public test page I might be able to look at here?

boreal shell
#

@waxen atlas -- Can you link Pompey to a test page on staging for this?

#

That should work

cyan bane
#

Thank you. Checking out that page

boreal shell
#

Hang on, Stripe isn't connected on that one

cyan bane
#

What do pre and post stripe mean there?

boreal shell
#

Give me a moment!

cyan bane
#

Gotcha

boreal shell
#

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

cyan bane
boreal shell
#

Yes, you are correct.

cyan bane
#

So whatever code ran may not have used that StripeAccount argument

boreal shell
#

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?

cyan bane
#

Yeah I'm here for a bit and after that a colleague will swap in who can also help.

boreal shell
#

Coordinating on our end. Shouldn't take long.

cyan bane
boreal shell
#

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.

cyan bane
#

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

boreal shell
#

Our internal API only ever calls CreateAsync with respect to payment intents

boreal shell
#

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.

cyan bane
#

I assume I should try the "post-stripe" option?

boreal shell
#

Either is fine, the naming is related to internal pricing as opposed to functionality.

cyan bane
#

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

boreal shell
#

One moment, I'll get you some.

#

Sent

cyan bane
#

Thank you, it actually turns out @median seal is stepping back in so I passed the credentials back along to them.

boreal shell
#

Ok

median seal
#

๐Ÿ‘‹

#

Taking a look

boreal shell
#

Thanks

median seal
#

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

boreal shell
#

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?

median seal
#

Can you share your full relevant client-side code here?

boreal shell
#

@waxen atlas ^

median seal
#

Wait... you must already be doing that

boreal shell
#

Yes -- our internal API creates the PaymentIntent and returns the Account ID and client secret.

median seal
#

Yeah so where does the GET request come into play here? Like why are you retrieving the PaymentIntent at this point at all?

boreal shell
#

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.

median seal
#

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] }

boreal shell
#

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.

median seal
#

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

boreal shell
#

Our FE is written in vue/typescript, so we're debugging the generated JS now..

median seal
#

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

boreal shell
#

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?

median seal
#

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.

boreal shell
#

We are currently confirming that we're calling loadStripe with the Connected Account ID

median seal
#

To answer your question, you pass the Account ID when you initialize stripe, not Stripe Elements

boreal shell
#

And it shows that we are.

median seal
#

Are you willing to share the relevant code?

waxen atlas
#
  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;
median seal
#

And can I see your Elements Provider Component code

waxen atlas
#
      <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>
median seal
#

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?

waxen atlas
#

We are using

"vue-stripe-js": "^1.0.1",

https://www.npmjs.com/package/vue-stripe-js

#

We have a vue3 app, not react

median seal
#

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'})

waxen atlas
#

trying it now

#

do you mean using the litteral hardcoded 'pk_test' and 'acct_123'?

median seal
#

No I mean with your key/account. But actually I don't think that is going to work.

#

Let's do a test actually

boreal shell
#

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
  }
}
median seal
#

That snippet is in your code or something you are seeing on github?

boreal shell
median seal
#

Ah gotcha

#

Can you do a test with:

console.log("testLog: ", testLog);
  stripeLoaded.value = true;```
#

And lets see what that logs

waxen atlas
#

will do

median seal
#

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?

boreal shell
#

We're literally looking at that on our end right now as well ๐Ÿ˜‰

#

Looking like we have a winner

median seal
#

That fixed it?

boreal shell
#

Looking like the payment was made -- our subsequent get to the PI may be failing, but we know why if that's the case.

waxen atlas
#

Thank you so much for your help @median seal , I think this is an us issue now ๐Ÿ‘

median seal
#

Glad to hear that you are unblocked!

#

Don't hesitate to let us know if we can help any further

boreal shell
#

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!

median seal
#

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 ๐Ÿ™‚

boreal shell
#

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.