#spanila

1 messages ยท Page 1 of 1 (latest)

dusk burrowBOT
brittle robin
#

stripeDirectOptions = { stripeAccount: trainerUser.paymentInfo.connectedAccountID};

idle perch
#

You can't tokenize payment method on the connected account and connect it to a customer object on the platform.

Ideally, you should tokenize and store the PaymentMethod on the platform (using SetupIntents) and clone it down to connected accounts when you plan to use them

brittle robin
#

i see, thats why it fails. its either customer doesnt exist or payment method doesnt exist

#

can i ask how to use setupintent with paymentintent?

#

let paymentIntentParams = {
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',
setup_future_usage: 'on_session',
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),
}
};
if (!paymentIntentParams.customer){
delete paymentIntentParams['customer'];
}
const paymentIntent = await stripe.paymentIntents.create(paymentIntentParams,
{
stripeAccount: trainerUser.paymentInfo.connectedAccountID,
apiVersion: CONFIG('stripe_api_version')
});

idle perch
brittle robin
#

this is a bit confusing. so i will not be using paymentintents at all? instead checkouts?

idle perch
#

No, you'd use SetupIntents to just store the payment methods first.

Then when it is time to charge the PaymentMethod, you'd clone it down and create the PaymentIntent for a direct charge

brittle robin
#

ok so before even creating paymentIntent, i should do this SetupIntent config. i will be doing it only if i dont have paymentMethod on the customer right?

idle perch
#

Correct

brittle robin
#

ok then, thanks for pointing me to the right direction. you guys have too many options ๐Ÿ˜„

idle perch
#

NP! ๐Ÿ™‚ Happy to help
Good luck