#tianyouli-connect
1 messages · Page 1 of 1 (latest)
request-id: req_I2UNACeAAGJOAZ
can you check in stripe, do you have this customer? cus_MdHTdlIlAcJZrB
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
ok. do I still need step 3) to attach platform-level payment method to a platform-level customer?
and its ok to only keep track of platform-level customers and payment methods, and always to the "cloning" when creating payment intent, right?
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?
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
ok. sounds like cloning customer is required but not necessarily "attach PM to customer"
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
in that case, when creating payment intent, I should not be passing customer ID but just the cloned payment method.
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
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.
Correct 👍
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
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.
And needing a seaprate PM attach request will depend on what your code is already doing - for example, if you are collecting payment methods with a Setup Intent that has customer (https://stripe.com/docs/api/setup_intents/create?event_types-payment_intent.payment_failed#create_setup_intent-customer) set, then the Payment Method will automatically be attached to that customer.
yes, we use setup intent. In the backend testing I'm doing, since i cannot use pm_card_visa for PM cloning. I used https://stripe.com/docs/api/payment_methods/create, and I tried to attach PM manually to a customer
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
you do have to path both the pm_123 and the cus_123
ok. I think I got it. thanks.