#MarkoBoras
1 messages ยท Page 1 of 1 (latest)
kk
If you created the subscription with a Checkout Session, then the subscription should automatically have a default payment method set that will be used for the invoices
Can you share the subscription ID (sub_xxx) where you saw this issue?
That subscription has set default payment method correctly
can you check out this custoemr
cus_NS3vbtu1MdSVH9
I need to set default payment method for downgraded subscription that will be activated in future
Wait, these are two different subscription. Both were created with a Checkout Session?
no no
sorry for bad explanation
- First subscription (YEARLY) is created through Checkout and that sub has good default payment method
- I have in the meantime through my app downgraded plan from YEARLY to MONTHLY and I update existing sub with
await stripe.subscriptions.update(subscriptionId, {
cancel_at_period_end: true,
});
Create new (MONTHLY)
const subscription = await stripe.subscriptions.create({
customer: existing.customer as string,
automatic_tax: { enabled: true },
items: [{ price: priceId }],
proration_behavior: 'none',
trial_end,
});
In this new monthly there is no payment method that I've added in checkout
I thought that'll work automatically
do I need to pass in creation of monthly sub payment method from the first sub?
Got it! So two things:
- You don't have cancel the existing subscription and create a new one. You could directly downgrade the existing subscription: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
- If you do want a new subscription, you need to make sure the customer has a default payment method set. And you can do so with
customer.invoice_settings.default_payment_methodhttps://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
can I somehow take default payment method from existing sub
const existing = await stripe.subscriptions.retrieve(subscriptionId);
and then pass it when I am creating new one
I've found
existing.default_payment_method
I'll try that now
and test
Yes that should work
While this takes time I have another few questions
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Does stripe support grace period by default?
it depends what your settings are for billing https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
under Manage failed payments
Ok, I'll come back
One question
When I am switching from free to monthly plan everything works as it should but it always creates some invoice for trial period which is 0.00$
user is not paying anything, it isn't bug bug why is it created?
it happens every time when I change priceId
=
?
that's expected
if there is a trial period
then we generate an invoice with $0
how can I turn off trial period
would you mind sharing the request ID for the subscription update please?
await stripe.subscriptions.update(subscriptionId, {
cancel_at_period_end: true,
});
jsut a sec
to find id
you mean invoice id
when you said request id?
in_1Mh6d1GeBYlVs2NBSCwWi4sgฤ
@swift blaze please keep your discussion here
Could you please share the Subscription Id ?I can't find the invoice Id you are sharing?
it is from the test clocks
just a se
sec
cus_NS18i6iGb1GK8w
sub_1Mh7FjGeBYlVs2NB5M5EBayw
I'll ask anotherquestion after we finish this
thanks for sharing let me check
ok
What is the issue with this subscription?
https://dashboard.stripe.com/test/subscriptions/sub_1Mh7FjGeBYlVs2NB5M5EBayw
You are asking about the failure? the subscription don't have a default_payment_method neither the customer
not failure
just asking how can I turn off
trial period invoice that is created
I mean it's not a blocker
or causing issues
You want to turn off what ? the trial period? the subscription?
Or you want to delete the test simulation ?
trial period
The trial period is finished for that simulation, The clock time of that simulation is March 4, 2025 at 9:00 AM GMT+1 while the trial period was already finished on March 3, 2025
Otherwise, To end a trial early, make an update subscription API call, setting the trial_end value to a new timestamp, or now to end immediately:
yes of course.
ok
so user is automatically subscribed to free plan (EVERYTHING WORKS OK)
user subscribes to monthly plan through checkout (EVERYTHING WORKS OK)
user decides to immediately upgrade plan from monthly to yearly through customer billing portal (EVERYTHING WORKS OK)
user can "UPDATE PLAN" from yearly to monthly immediately in customer portal and he doesn't pay for it because he has credit balance (???)
amount that he has paid for yearly plan but he didn't use it is added in his credit balance
cus_NS5Cid1kEFR5Ts
This is not behavior that I want, how can I fix this
I want this:
- When user upgrades to yearly plan (buys immediately yearly plan or upgrades from monthly to yearly) he can only downgrade to monthly or free, or he can cancel his current plan
Can I somehow in stripe customer portal turn off "Update plan" button if user is already on yearly plan?
I don't know if I've explained right
are u here?
?
๐ taking over for my colleague. Let me catch up.
kk
the idea is that when you downgrade we will calculate the proration
and based on that the unused period will entitle the customer a credit balance
which will be used to pay the monthly plan
yeah I see that
first question
can I redirect user immeditealy after he buys something in customer portal back to my app?
or user needs to manually click and close
not really
ok
then, can I disable in customer portal that user can downgrade from yearly to monthly plan?
I want to avoid this
I don't think it's possible to configure it in upgrade but not in downgrade
๐ฆ
reason why I'm using customer portal is for 2nd time subscriptions where I need prorated subscription
to calculate unused time
is that also possible to achieve with stripe checkout?
no not really with Checkout
but you can develop it in your own
this way you can have more control over Upgrading but not Downgrading
and use the Customer Portal to let customers manage their Payment Methods
sorry quick question
are you using the API to create the Customer Portal?
da
yeah
sorry hahah
If I could somehow on first success action in customer portal redirect user back to app everything would be solved
or disable downgrading from yearly to monthly through portal
because user can downgrade through my app via API call
and he is downgraded when existing subscription ends
that's what I want
and this flow from customer portal is killing my current flow ๐ฆ
sorry I missed this before
you can choose which products are eligible on the Customer Portal by configuring it here https://dashboard.stripe.com/test/settings/billing/portal
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.