#yandos666-cloning-PMs

1 messages ยท Page 1 of 1 (latest)

lime parcel
keen onyx
#

Thanks! how does this work if you are just creating a payment Intent for the first time and so dont yet have a payment method attached to the customer?

lime parcel
#

Can you elaborate? If you don't have a payment method, then it's too early in the process to be able to clone said payment method.

keen onyx
#

So ATM we're creating a payment Intent and attaching a customer to the PI, thats then passed to usual stripeJS form to collect payment details yada yada - this way the payment method is automatically attached to the customer on completion

I guess instead we dont create the customer at point of creating the initial PI and do it after completion of payment?

lime parcel
#

Let's take a step back, because I'm a little confused as to whether you're trying to create the payments at the platform level or at the connected account level.

#

Can you give me a brief overview of what you're trying to accomplish?

keen onyx
#

so we're trying to achieve whats mentioned in the link you shared - being able to re-use payment information on multiple connected accounts.

The payment itself is a direct charge against the connected account

How we're doing that (so far) is to create a PI against the connected account:

\Stripe\PaymentIntent::create(['customer'=>''foo','amount'=>'bar'],['stripe_account' => {CONNECTED_ACCOUNT_ID});

the customer currently being passed into the above is one we've created under the connected account

lime parcel
#

Gotcha, so if you're working with direct charges, then everything is going to be happening on the Connected Accounts. In this case the Payment Method that is created would be on the Connected Account and would not be available to be shared.

Instead, you'll want to look into using a Setup Intent flow to capture payment method details on the Platform account, and then clone that Payment Method to your connected accounts later.
https://stripe.com/docs/payments/save-and-reuse

keen onyx
#

Thanks - so we'd:

  1. create a setup intent, use a Payment Element to get the payment method back and store this at a platform level for re-use
  2. clone this PM against a connected accounts customer
  3. Use the same direct charge method we'd using now to create the PI, passing through the customer and PM
  4. profit?
lime parcel
#

Yup

#

(PS, love the profit bit ๐Ÿ˜‚ )

keen onyx
#

haha! in this instance profit = me crying into a corner

#

Thanks Toby!

lime parcel
#

Any time!