#gregers
1 messages ยท Page 1 of 1 (latest)
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.
So I'm initializing Stripe using:
# Passing the PK of the platform account
await loadStripe('pk_test_asd123')
Yeah, that won't work. See here: https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application
That's great!
Ok one more quick Q for you
So I see 2 different approaches here potentially:
- Create the intent up front and initialize elements by passing
clientSecret - Defer creation of the intent and initialize elements using the
mode/onBehalfOfparameters
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
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?
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
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.
Riiiight
See here for more details: https://stripe.com/docs/connect/charges#destination
so we would specify destination and onBehalf of rather than creating within the connected account
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.
Have a look at this flow: https://stripe.com/docs/payments/accept-a-payment-deferred
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
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 ๐
Happy to help!
FWIW I think it is actually this doc which lead me astray: https://stripe.com/docs/connect/dynamic-payment-methods?connect-payment-integration-type=payment&connect-account-type=custom&connect-charge-type=destination&on-behalf-of=true#integrate
You can see that I have selected Custom at the top and yet it is telling me to use a direct charge in the linked section
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.
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
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.
In that scenario the connected account settings do take effect. The ones here: https://dashboard.stripe.com/settings/payment_methods/connected_accounts
So is that where we might use this API method for determining payment method availability of connected accounts? https://stripe.com/docs/connect/dynamic-payment-methods?connect-payment-integration-type=payment&connect-account-type=custom&connect-charge-type=destination&on-behalf-of=true#enable-custom
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 ๐
Yep, that sounds correct!
Great thank you so much once again! The pieces are coming together ๐งฉ
Awesome!