#phillip_api

1 messages ยท Page 1 of 1 (latest)

unborn cedarBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1344991674736316487

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

wide latch
#

hi there!

#

is you set the payment method as the default one, then will be used for all future invoice of that customer. unless you already set a default payment method on the subscription itself, in which case it has priority.

hoary thunder
#

Hi Soma, got it!

So basically I can remove default_payment_method from here

const subscription = await stripe.subscriptions.create({
            customer: customerId,
            items: [{ price }],
            trial_period_days: trialPeriodDays,
            default_payment_method: paymentMethod,
            promotion_code: promotionCodeId,
            collection_method: "charge_automatically",
            automatic_tax: {
                enabled: true
            }
        });

... and Stripe will just use the customer default payment method?

wide latch
#

yes

#

and you can update the default payment method for existing subscriptions if needed

hoary thunder
#

Okay,

  1. This way I can solve this problem for future users โœ…
  2. For the customer who has reported this issue, I can also manually change the payment method in the Stripe dashboard โœ…
  3. However, now we have like 100 customers and we've always set default_payment_method: paymentMethod, in every subscription. This means if they try to change their credit card, they will encounter the same issue as the customer who has reported it.

3a) is there a way to "unassign" the default payment method from each subscription and let each customer use their default customer payment method? Because I didn't find a way in the Stripe dashboard.
3b) or would the only solution be to always update the Stripe Subscription default payment method as well whenever the customer changes their payment method?

I hope you can understand my problem...

wide latch
#

is there a way to "unassign" the default payment method from each subscription
yes, but you need to use the Stripe API.

hoary thunder
#

Got it. Can I simply pass undefined to unassign it?

const subscription = await stripe.subscriptions.update(subscriptionId, {
    default_payment_method: undefined,
});
wide latch
#

no, you need to pass empty string ""

hoary thunder
#

Got it! That's all. I appreciate the help ๐Ÿ™