#Alfie-cloning-pms
1 messages · Page 1 of 1 (latest)
cus_LZaXW0GnWKDEXo This platform customer tried booking through this connected account. acct_1JuZuFKtQYabvPKI
Thanks 🙂
Can you share the cus_xxx from the connected account?
You wouldn't use that ID for a PI with direct charges
So I believe the error came from trying to clone the customer to the connected account, because the customer hasn't appeared on the connected account in stripe dashboard
// first we need to tokenise the customer
const token = await stripe.tokens.create({
customer: stripe_customer_id,
}, {
stripeAccount: stripe_connect_id,
});
// and then use the token to clone the customer onto the connect account
const customer = await stripe.customers.create({
source: token.id,
}, {
stripeAccount: stripe_connect_id,
});
// then we can clone the existing payment method for the customer (from the card they created)
const clonePaymentMethod = await stripe.paymentMethods.create({
customer: stripe_customer_id,
payment_method: stripe_paymentMethod_id,
}, {
stripeAccount: stripe_connect_id,
});
// now we can attach the cloned pm to the cloned customer
const attachPaymentMethod = await stripe.paymentMethods.attach(
clonePaymentMethod.id,
{
customer: customer.id,
},
{
stripeAccount: stripe_connect_id,
},
);
This is the flow
I'm assuming the error happened somewhere in here
Should I be adding the (platform) payment method in the stripe.customers.create({ function?
But then it's worked without issues for a number of people
Final step
payment_method_types: ['card'],
amount: amount_to_pay,
currency: 'gbp',
application_fee_amount: 0,
statement_descriptor_suffix: 'Booking ' + professional.get('first_name'),
customer: result.stripe_customer_id,
payment_method: result.payment_method_id,
// We can charge immediately but we need the payment method.
confirm: true,
off_session: true,
}, {
stripeAccount: professional.get('stripe_connect_id'),
});
Can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Ahh awesome I didn't know about these logs. req_XOYsl3CkfHlzon
So yeah it's the token call.
These are the other two
req_P4Cu0q6rbNI8IO
req_JHgimFLNGQUue4
Will take a look soon
Thanks
Oh I had one other q, we are interested in the Stripe Terminal Tap to Pay beta. We are obviously UK based, will it be possible for us to join the beta soon at all?
Have you seen this doc? https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
Not sure when it's launching in UK, but you can register here: https://stripe.com/terminal/tap-to-pay-on-iphone
Thanks yeah will register interest.
General steps for PM cloning:
- Collect payment details and create PM on platform account (recommended via a Setup Intent which will attach to customer, and carry out 3DS).
- Create a new PM using the platform API keys, passing the
Stripe-Accountheader:
const paymentMethod = await stripe.paymentMethods.create({
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
}, {
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
});
- Use in PI and pass
setup_future_usageparameter to save to connected account Customer for on/off-session payments.
So I don't need to clone the customer itself to the connect account?
We are currently using the connected customer id when we create the paymentIntent, is that not necessary?
Nope!
Yes, you'll need to use the Customer object/ID on the connected account for direct charges
Isn't that contradictory? Or am I missing something? I need the customer_id on the connect account for direct charges, so I will need to clone the customer onto the connected account first right?
You don't need to clone the customer, you'd just create a new one on the connected account
ahh ok
So here, I can replace this with just creating the new customer
const token = await stripe.tokens.create({
customer: stripe_customer_id,
}, {
stripeAccount: stripe_connect_id,
});
// and then use the token to clone the customer onto the connect account
const customer = await stripe.customers.create({
source: token.id,
}, {
stripeAccount: stripe_connect_id,
});
I don't need to tokenise the platform customer at all
Yep! That's the old way of doing things pre-Payment Methods API
Right. Thanks I'll try implementing that this afternoon after lunch!