#tianyouli-connect

1 messages · Page 1 of 1 (latest)

split trout
#

Can you share the request ID that gave you that error message so I can take a look?

vocal matrix
#

request-id: req_I2UNACeAAGJOAZ

sonic mason
#

can you check in stripe, do you have this customer? cus_MdHTdlIlAcJZrB

vocal matrix
#

Yes, it's there

#

(the customer)

split trout
#

Your issue is that afterr step 4 (when you clone the payment method) you need to attach the newly cloned payment method to a customer on the connected account (so yes, you need to clone the customer).

#

Once you have attached it to a Customer on the connected account, you'll use that customer ID when you create the Payment Intent

vocal matrix
vocal matrix
#

https://stripe.com/docs/connect/cloning-customers-across-accounts this is what I found: 1) create a token from platform-level customer in a connected account 2) create a connected-account-level customer using the token 3) (not in the page) attach the PM cloned in my test already and attach that to the cloned customer 4) create PaymentIntent using cloned payment method and customer. Do the steps sound right?

With Connect, you can clone your customers' payment information across multiple connected accounts for reuse.

split trout
#

yup! that sounds correct

#

but if the payment method you're cloning to the connected account is just for one-time use (you don't want to reuse it) you don't have to atttach it to a customer - you'd just create the payment intent and not pass in any customer ID

vocal matrix
#

ok. sounds like cloning customer is required but not necessarily "attach PM to customer"

split trout
#

Cloning the customer is only required if you want to save the cloned Payment Method for future usage (since you can only use a PM more than once if it's attached to a customer).

#

If you only need to use that cloned PM once, then you don't need to clone the customer

vocal matrix
#

in that case, when creating payment intent, I should not be passing customer ID but just the cloned payment method.

split trout
#

Yup! If you plan on always cloning the PM for each payment intent, you can jsut omit the customer ID when you create the PI

vocal matrix
#

gotcha. Looks like I should attach platform-level PM to platform-level customer always, otherwise the platform-level PM is "gone" after creating the payment intent.

split trout
#

Correct 👍

vocal matrix
#

is that something I should do for production code? or front-end integration via Stripe.js will ensure the payment method is attached to a customer somehow? We did not seem to need to call "pm.attach(customerId)" before but now probably a good idea?

#

ok. here's the thing, we do plan to reuse the platform-level payment methods. So looks like we need to do the customer cloning and PM attaching

#

com.stripe.exception.InvalidRequestException: The payment method you provided is attached to a customer so for security purposes you must provide the customer in the request.; request-id: req_oQ1YGpl2dO71eT

split trout
#

Sorry let me be clear - if you reuse the connected-account cloned payment methods then you need to also clone the customers. If you're just reusing the platform-level payment methods then you don't need to clone the customer - you'll be safe with just having the customer on the platform.

vocal matrix
#

but then I got the error message of The payment method you provided is attached to a customer so for security purposes you must provide the customer in the request.; request-id: req_oQ1YGpl2dO71eT for not passing customer ID when cloning PM

runic nest
#

you do have to path both the pm_123 and the cus_123

vocal matrix
#

ok. I think I got it. thanks.