#spanila
1 messages ยท Page 1 of 1 (latest)
stripeDirectOptions = { stripeAccount: trainerUser.paymentInfo.connectedAccountID};
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
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')
});
SetupIntents are separate APIs. This guide covers it
https://stripe.com/docs/payments/save-and-reuse
this is a bit confusing. so i will not be using paymentintents at all? instead checkouts?
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
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?
Correct
ok then, thanks for pointing me to the right direction. you guys have too many options ๐
NP! ๐ Happy to help
Good luck