#alex-subscription-paymentmethod

1 messages · Page 1 of 1 (latest)

oblique tinselBOT
craggy horizon
#

alex-subscription-paymentmethod

#

the problem you had is basically you accepted a payment but never "saved" that PaymentMethod as the default payment method on the Customer or Subscription so on the next Invoice there's nothing to pay it

scarlet ivy
#

Thanks @craggy horizon!
That means this should fix the problem, right:
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
{
price: req.body.price_id,
},
],
payment_behavior: "default_incomplete",
payment_settings: {save_default_payment_method: "on_subscription"},
expand: ["latest_invoice.payment_intent"],
coupon: req.body.coupon,
});

craggy horizon
#

yes, with that, future subscriptions will have that pm_123 as the default after you confirm it successfully

scarlet ivy
#

Ok, thx. So I need to execute this, right?
const subscription = await stripe.subscriptions.update(
'sub_1M9tg42Tb35ankTnQxxxxxxx',
{default_payment_method :"pm_1LxgzhD2E0GHKjbdvgCJxxxxx"},
);

craggy horizon
#

yes!

scarlet ivy
#

Thanks man! Saved my day 👏