#_nerder

1 messages · Page 1 of 1 (latest)

stray gateBOT
whole smelt
#

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.

narrow valley
#

Ok that makes sense

#

So i'll try to reframe to adapt for my scenario, and you can confirm me if this makes sense.

#
  1. 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.
  2. Later when the customer attempts for instance to add a new payment method, I only attach it to my platform account.
  3. 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
whole smelt
#

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?

narrow valley
#

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)

whole smelt
#

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.

narrow valley
#

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

whole smelt
#

Yes.

narrow valley
#

Can you point me to the right API doc for cloning the payment method?

#

nvm i found it I guess

whole smelt
#

Yep, that's it! 🙂

narrow valley
#

but this link is not what I actually need to do i guess

#

this is what you've suggested for direct charges

whole smelt
#

That's what you need to do.

#

Subscriptions you create on a Standard connected account are considered a form of direct charges.

narrow valley
#

ok than, that's cool!

whole smelt
narrow valley
#

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

whole smelt
#

Yep, that makes sense for your use case.

narrow valley
#

Ok then I think i have it all clear:

Scenario 1: No payment method on the platform account

  1. At the time of the first purchase, create a customer in the platform account
  2. Attach a payment method to it
  3. Create a customer in the connected account
  4. Create a payment method in the connected account (using the same payment method ID from the platform's one)
  5. Create the subscription using the customerID (from the connected accont's customer)
#

Scenario 2: A payment method is present in the platform account

  1. Create a customer in the connected account
  2. Create a payment method in the connected account (using the same payment method ID from the platform's one)
  3. Create the subscription using the customerID (from the connected account's customer)
whole smelt
#

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.

narrow valley
#

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?

whole smelt
#

Nothing will happen... you'll create it more than once.

narrow valley
#

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

whole smelt
#

Correct.

narrow valley
#

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?

whole smelt
narrow valley
#

oh that's good!

#

I think I have it all clear then @whole smelt

#

thank you so much for the clarification