#sarim_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1397927939273658501
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hey there, the last example (payment method create) is the way to achieve this to clone to a connected account for direct charges.
Can you share an example of the erroring request(s) so that i can offer guidance?
{
"error": {
"message": "The customer must have an active payment source attached.",
"request_log_url": "https://dashboard.stripe.com/acct_1P6xmtLuwK2Ip1t6/logs/req_Ivrb6y5e7aqas1?t=1753326016",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Request POST body
{
"customer": "cus_SjZdEMNSyqgDGc"
}
Oh, dont make this call
Since you're now collecting payment methods, use the payment method create call you showed instead
I am getting this error while cloning a customer here
$token = \Stripe\Token::create([
'customer' => $platForm_customer_id,
], [
'stripe_account' => $connected_account_id,
]);
let me explain the flow
$payment_method = \Stripe\PaymentMethod::create([
'customer' => $platForm_customer_id,,
'payment_method' => $platForm_pm_id,
], [
'stripe_account' => $connected_account_id,
]);
This piece you shared should do what you want
so we don't need to clone the customer from now?
That call is not "cloning a customer" its trying to create a token on the connected account.
yes
the "clone a customer" flow is a bit of a misnomer, the customer itself is never copied, only a new card copy is made, and you manage the customer yourself
the is the complete example to clone customer
$token = \Stripe\Token::create([
'customer' => $platForm_customer_id,
], [
'stripe_account' => $connected_account_id,
]);
$customer = \Stripe\Customer::create([
'source' => $token->id,
], [
'stripe_account' => $connected_account_id,
]);
Yea but you're not using tokens anymore
yes. so the solution is we don't need to copy the customer jsut clone the payment method for connected account
remember we only collecting card info one time and charging the customer for connected accounted later on.
If you want to track the payments and re-use the payment method on the connected account, you can optionally create a customer on the connected account and attach the cloned payment method, but this is not required
your recommended flow?
So you've already got the platform customer and creating+confirming setup intents for them:
Create SI: https://dashboard.stripe.com/logs/req_WSUNOux4PZDnGr
Confirm SI: https://dashboard.stripe.com/logs/req_p8yvH3chocIYPC
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yes
After that succeeds, you then have a PM attached to the customer
yes we are creating setup intent using customer id
Do you want/need customer objects on the connected accounts, or not?
we are just making payments for connected account other than that we are not using any where customer for connected account
The flow can work with or without them, so whether you need them or not is purely based on your business purposes
Ok, so lets leave them out for now
You should remove both of these calls then
and go directly to this call
the result will be a one-time-use PM on the connected account that you can use to create a payment intent
(you still have the re-usable PM on the platform customer that you can clone again later to the same or different connected accounts for future payments)
got it but what if we need to how can clone customer for connected account. in this flow
You just create the customer on the connect account, without the token parameter. You can optionally pass in payment_method or attach the cloned PM after creation
https://docs.stripe.com/api/customers/create#create_customer-payment_method
https://docs.stripe.com/api/payment_methods/attach
Like i said, there really isn't any way to clone a customer -- just cards (and bank accounts) from platform customers
Creating the connected account customer is done manually by you, when needed
ok ok so we don't need it at all as we are already creating pm for connected account. Does setupIntent and confiming it on frontend will suport the 3D Secure / SCA: card authentication for future use?
I wasn't able to test it on beta in test mode
It does set it up for future, but you still need to be prepared to handle future authentication when banks ask for it
This can happen on any future payment, whether or not the card was previously authenticated, and is entireyl at the customer banks discretion
paymentIntent are being created on beta with status action required in test mode
What beta are you referring to? Yes requires_action is the status when additional actions (like 3ds) are needed for complete payments.
What was the issue with your tests?
sorry beta is our env where we are using test mode
We have 3ds test cards you can use to exercise this path: https://docs.stripe.com/testing#authentication-and-setup
the x3155 card will require 3ds on the first PI/SI, but then not for future off session payments
the x3184 card will require 3ds for every payment, even after you set it up, so you can test your recovery flow