#gregers

1 messages ยท Page 1 of 1 (latest)

loud salmonBOT
near abyss
#

Hello! If you're creating the Payment Intent on the connected account (for direct charges) you also need to initialize Stripe.js with your platform's publishable key and the connected account's ID so the API requests are made on that account, not your platform.

#

In other words, the Payment Intent only exists on one account, and you need to make sure Stripe.js is accessing that same account.

sonic kestrel
#

So I'm initializing Stripe using:

# Passing the PK of the platform account
await loadStripe('pk_test_asd123')
sonic kestrel
#

I see! Let me try

#

Okay fantastic that is working now ๐Ÿ˜„

near abyss
#

That's great!

sonic kestrel
#

Ok one more quick Q for you

#

So I see 2 different approaches here potentially:

  1. Create the intent up front and initialize elements by passing clientSecret
  2. Defer creation of the intent and initialize elements using the mode / onBehalfOf parameters

Realize you don't know anything about our business case / app structure, but which would you think is the best approach?

#

The docs seem opinionated towards initializing using clientSecret

near abyss
#

The best approach does indeed depend on your business needs, desired payment flow, any requirements you might have, etc. Can you tell me what your desired payment flow would look like?

sonic kestrel
#

So it will be a Stripe connect custom integration, we are planning to use dynamic payment methods including bank transfers and potentially BNPL payment methods

#

The business case is invoicing and booking software

#

I believe it is possible the payment amount could change after the intent is setup so we might need to adjust the amount when that happens

near abyss
#

If you're using Custom connect accounts you should be using destination charges, not direct. With destinations charges the Payment Intents exist on your platform, not the connected account.

sonic kestrel
#

Riiiight

near abyss
sonic kestrel
#

so we would specify destination and onBehalf of rather than creating within the connected account

near abyss
#

Yes.

#

If you need to adjust the amount late in the payment flow it's usually best to create the Payment Intent later in the flow rather than earlier.

sonic kestrel
#

I guess with the clientSecret we actually NEED to create the intent before we can render Elements

#

so that might be a factor in choosing between option 1 /2

near abyss
#

No.

#

See the flow above.

#

It allows you to use Elements without a client secret.

sonic kestrel
#

Yes gotcha

#

So this would mean option #2

#

Ok I think I understand much better now thank you

#

have a bit more to chew on thanks to your help!

#

Let me step back and take this in now

#

Thanks so much for the nudge in the right direction!

#

Very helpful ๐Ÿ™‚

near abyss
#

Happy to help!

sonic kestrel
near abyss
#

The charge type and connected account type selections are separate because it is technically possible to use direct charges with custom accounts, but it's very much not recommended. We can certainly improve this to warn people about that though! I'll flag internally.

sonic kestrel
#

There is actually one thing I'm still trying to find a reference for. Now that the charge is created on the platform account, is it expected that I toggle payment methods from the platform settings? (Rather than connected account payment method settings)

Maybe put another way, how can I get dynamic payment methods working when using destination charges?

#

When I switched from the direct charge -> Destination charge some of the payment methods I had selected dissapeared

near abyss
#

Yeah, when doing destination charges the payment method settings on your platform are the ones that apply, as that's where the payments are happening.

#

However, if you're doing on behalf of, that can make things a bit tricky, as in that scenario the connected account is the merchant of record.

sonic kestrel
#

Ok so given we are using on behalf of (not in my POC yet) I can expect connected account payment methods to apply

#

Which is nice, since it looks like you guys automatically confirm the accounts available payment methods

#

Rather than us having to do it via API

#

Does that sound correct?

#

Ok yes... passing on_behalf_of and now the payment methods for the connected account are back ๐Ÿ™Œ

near abyss
#

Yep, that sounds correct!

sonic kestrel
#

Great thank you so much once again! The pieces are coming together ๐Ÿงฉ

near abyss
#

Awesome!