#Hazim
1 messages · Page 1 of 1 (latest)
const paymentMethod = await stripe.paymentMethods.attach(
setupIntent.payment_method,
{ customer: customerId }
);
const customer = await stripe.customers.update(customerId, {
invoice_settings: "default_payment_method",
});
what I do is attach the payment method to the customer
then I want to make it as the default payment
Hi, that is correct, you'd need to update the customer object to set the default payment method: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Yes but it doesnt work :/
I don't see the default tag near the customer payment methods :/
Can you share the request id where you made this update request please so I can further debug this?
of course
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
I just tested this and it's working as expected. I think the issue might be that you're not passing the payment method id on the Customer Update request. Your code would look something like this:
const customer = await stripe.customers.update(customerId, { invoice_settings: "default_payment_method": "pm_xcn232", });
@turbid canyon give it a try and let me know if that does not work and share the request id for that Customer Update call please.
Haha!
It works
thanks
I knew it was something stupid
you dev services are really premium
Yeay! Glad to hear. I do this all the time too so happy to be the rubber duck here