0

I am getting the following error message when I update a Stripe client: Error: Received unknown parameter: payment_method My code:

var customer = await stripe.customers.update(
  user.stripe_id,
  {payment_method: req.body.paymentMethodId}
);

How do I update a Stripe client's payment method? I tried using source, but source doesn't accept a paymentMethodId.

2 Answers 2

1

To update a customer’s payment method you can use invoice_settings.default_payment_method (https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method). This sets the default PaymentMethod for the customer’s future Invoices and Subscriptions only.

0

If what you are trying to do is attach a new payment method to the customer than you will want to do something like this.

const paymentMethod = await stripe.paymentMethods.attach(
  'pm_1IwABt2eZvKYlo2CRqildJzv',
  {customer: 'cus_4QEipX9Dj5Om1P'}
);

(https://stripe.com/docs/api/payment_methods/attach)

Not the answer you're looking for? Browse other questions tagged or ask your own question.