#spanila

1 messages · Page 1 of 1 (latest)

muted currentBOT
fringe thunder
#

customer id is cus_OaVacWYqyN9tla

lunar crater
#

hi, yeah unfortunately the docs are really bad

fringe thunder
#

i will try right away

#

but to clone paymentMethod, i first need to create customer on the connected account right?

#

and the token step was doing just that

lunar crater
#

no, you don't need a Customer on the connected account, but you do need one on the platform

#

in the snippet of code at that link, the CUSTOMER_ID is the ID of the customer on the platform whose card you are cloning(which I know is a confusing since it looks like you're making that request on behalf of the connected account so you'd usually expect the IDs to have to exist on the connected account; this request is the one exception to that rule).

fringe thunder
#

oh, so this is shared customer of sorts. nice

#

well shared customers would be GREAT

#

nvm

#

paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
customer: clonedCustomer? clonedCustomer.id : null,
automatic_payment_methods: {enabled: true},
application_fee_amount: fee,
use_stripe_sdk: true,
capture_method: 'manual',
description: event.course.name + ' ' + U.formatDatetime(event.datetime, event.trainer?.user?.timezone),
metadata: {
eventID: event.id,
userID: self.user.id,
eventAttendanceType: U.getEventUserAttendanceTypeByCode(params.eventAttendanceType),
}
}, stripeOptions);

#

this is the way i was creating paymentintent. but now i have paymentmethod (single, would be great if multiple were possible) and no customer. how can i add the customer and multiple payment methods?

lunar crater
#

well after cloning you have a PaymentMethod that exists on the connected account, that's it

#

so to charge that you can create a PaymentIntent with like {amount:500, currency:usd, payment_method:"pm_clonedPaymentMethodID"},{stripeAccount:"acct_xxx"} , you don't explicitly need another Customer on the connected account

#

usually I suggest not storing the PaymentMethod on the connected account if you can avoid it, since it's generally easier if you use the platform customer as the source of truth and then clone on demand when you need a payment

fringe thunder
#

i liked the idea of having platform customers with multiple payment methods and then when creating paymentintent, i would populate frontend component with customer and he can choose the right card.

#

the way you suggested - suppliying payment method really restricts the user to the default payment method. whats the point of adding cards then.

#

so i would like to keep customer in paymentmethod if possible and clone it, but the cloning part was token request that failed right?
const token = await stripe.tokens.create(
{
customer: '{{CUSTOMER_ID}}',
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);

#

so is there another way to clone customer?

lunar crater
#

there is no such thing as cloning a 'customer'

fringe thunder
#

then i could clone the paymentMethods on connected accounts as you showed me and attach them. and they should be on the ui together with customer information for connected account user.

lunar crater
#

that is just a misnomer and part of the awful docs I referenced

fringe thunder
#

😄

lunar crater
#

what is actually cloned is the customer's payment method, and that is all

fringe thunder
#

oh the token was cloning his payment methods

#

so i need to create it

lunar crater
#

forget about tokens

#

but they do the same thing, which is copy a Customer's payment method from the platform to the connected account. And that's all they do, and that is all that the API provides, that is the building block, and using that the idea is you can build a concept of a "shared customer" in your integration (which is why it's called that in the docs)

fringe thunder
#

ok, i think i get it now

#

well, no other way than try really, thanks for info.