#_nerder
1 messages · Page 1 of 1 (latest)
Hello! Typically the way this works is you save the payment info on your platform account, then clone that Payment Method to each Standard account for each direct charge as needed.
Ok that makes sense
So i'll try to reframe to adapt for my scenario, and you can confirm me if this makes sense.
- The first time a customer attempts to purchase anything from any one of our connected accounts I create the customer in the Platform account saving the payment method, and also in the connected account and also save the payment method there.
- Later when the customer attempts for instance to add a new payment method, I only attach it to my platform account.
- Then when they attempt to purchase something else with the new payment method, I first attach the payment method onto the connected account customer and then complete the purchase
For #1, the first part is correct, but you would not create a customer on the connected account. The cloned Payment Method would only be used for that one direct charge and is never used again. If you want to make another direct charge on that connected account later you would clone again from the primary Payment Method on the platform.
This ensures you only have one Customer and one Payment Method to keep up to date (the one on the platform) and you clone as-needed for every direct charge.
#2 is correct.
#3 I don't entirely understand, can you elaborate?
The problem with #1 is that I'm usually talking about subscriptions creations not independent charges, so I need to also have a customer into the connected account
to make it more clear in the use case, we are a platform for gyms. We offer a multi-gym experience where people can switch gyms have purchase memberships from different places (even simultaneously)
Ah, that's different, and not what you originally described. For Subscriptions on the connected accounts you do need a Customer, and you would attach the cloned Payment Method to the Customer on the connected account, yes.
Ok then, that's more clear. Every time that a user joins a new gym i create it as a customer in the connected account cloning the payment method from the customer stored in the platform
Yes.
Can you point me to the right API doc for cloning the payment method?
nvm i found it I guess
Yep, that's it! 🙂
but this link is not what I actually need to do i guess
this is what you've suggested for direct charges
That's what you need to do.
Subscriptions you create on a Standard connected account are considered a form of direct charges.
ok than, that's cool!
Have a look here: https://stripe.com/docs/connect/subscriptions#customer-connected-account
yes this is what we already doing:
const stripeSub: Stripe.Subscription = await this.stripe.subscriptions.create(
{
customer: customerId,
items: [
{
price: priceId,
},
],
cancel_at_period_end: isOneOff,
application_fee_percent: gym.transactionFee.percent,
trial_period_days: trialDays,
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent', 'pending_setup_intent'],
},
{
stripeAccount: gym.accountId.value,
},
);
the only thing will be to attach the payment method before creating the subscription
Yep, that makes sense for your use case.
Ok then I think i have it all clear:
Scenario 1: No payment method on the platform account
- At the time of the first purchase, create a customer in the platform account
- Attach a payment method to it
- Create a customer in the connected account
- Create a payment method in the connected account (using the same payment method ID from the platform's one)
- Create the subscription using the customerID (from the connected accont's customer)
Scenario 2: A payment method is present in the platform account
- Create a customer in the connected account
- Create a payment method in the connected account (using the same payment method ID from the platform's one)
- Create the subscription using the customerID (from the connected account's customer)
To clarify for #4, when you clone you'll specify the Payment Method ID from the platform as the Payment Method to clone from, but the cloned Payment Method that's created on the connected account will have a brand new, unique ID.
The rest seems correct though, yep.
yes i've imagined, but this is not an issue since i'll always use the customerID from the connected account's customer
What happen if you create a payment method more then once in the connected account?
Nothing will happen... you'll create it more than once.
ok then, i don't need to check if that payment method has already been created (from the platform to the conencted account I mean)
i just create it again for every purchase attempt and that's it
Correct.
last question then, Is it worth to put in place a process to clean up every occurrencies of that payment method in each conencted account where has been created (upon deletion on the plaform account)?
is this even actually possilbe, since IDs will be different as you've said before?
You can do this if you wish. You can use the fingerprint to determine if two Payment Methods represent the same card, for example: https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-fingerprint