#ubi
1 messages · Page 1 of 1 (latest)
hello! i believe this is what you're looking for? https://stripe.com/docs/payments/finalize-payments-on-the-server
hah, thank you so much, my apologies for missing that, honestly getting overwelmed by so much information, and tabs, and sections ... 😦
I am confused by the documentation,
// Create the PaymentMethod using the details collected by the Payment Element
const {error, paymentMethod} = await stripe.createPaymentMethod({
elements,
params: {
billing_details: {
name: 'Jenny Rosen',
}
}
});
How do you specify the user associated with the payment method?
are you referring to the Customer object?
I guess so, yeah
that would be passed in when you create the PaymentIntent : https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer
Just to confirm, I dont need to worry about Customer when using createPaymentMethod?
no, you don't need to worry about the Customer object when using createPaymentMethod
What would be the downside of calling createPaymentMethod too many times?
Based on the example code provided, here https://stripe.com/docs/payments/finalize-payments-on-the-server
I have few side-effects (promises) that could fail
- elements.submit
- createPaymentMethod
- create-confirm-intent
So if step 3, create-confirm-intent fail I will be retrying the other steps multiple, just wondering if I should be concerned about it in your side or not
Nothing comes to mind for me, is there something that you're concerned about specifically?
no, no really, just the side-effect in your side to keep creating payment methods I am guessing
Not sure if that is ephemeral until it is part of a payment intent or attached to a customer 🤷♂️

Last thing, our users could pay for multiple courses, so, if I pass a payment intent with a Customer object, would that create different customers even when I pass the same shape?
Should I create a single Customer first, and use the ID of it instead?