#coding-lover_api
1 messages · Page 1 of 1 (latest)
đź‘‹ 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/1361673526909604062
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- coding-lover_code, 1 day ago, 10 messages
- coding-lover_api, 4 days ago, 12 messages
- coding-lover_api, 5 days ago, 4 messages
- coding-lover_code, 6 days ago, 29 messages
yes
Then you can list all Subscriptions with status=active: https://docs.stripe.com/api/subscriptions/list#list_subscriptions-status
how to do in cli
if subscription is cancelled or cancelled due to non payment after trial, Is it possible to reactive it or need to create new one?
You can see examples in all languages here:
You need to create a new one.
so I need to pause subscription instead of cancelling
const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [
{
price: price.id,
},
],
payment_behavior: 'default_incomplete',
trial_period_days: 60,
trial_settings: {
end_behavior: {
missing_payment_method: 'cancel',
},
},
});
Currently I'm doing this
No, you can't pause Subscriptions with Stripe. There's a feature that pauses payments - meaning you offer your product for free.
after trial if user want to get subscription I need to create new one?
After 2 months customer unable to pay and his subscription cancelled so he need to subscribe to new one instead of reactive new one?
there is a method in stripe docs stripe.subscriptions.resume
Copilot suggest me this
async function reactivateSubscription(subscriptionId) {
try {
const subscription = await stripe.subscriptions.retrieve(subscriptionId);
let updatedSubscription;
if (subscription.status === 'canceled') {
// Reactivate a canceled subscription
updatedSubscription = await stripe.subscriptions.update(subscriptionId, {
cancel_at_period_end: false,
collection_method: 'charge_automatically',
items: [
{
id: subscription.items.data[0].id,
price: subscription.items.data[0].price.id,
},
],
});
} else if (subscription.cancel_at_period_end) {
// Remove pending cancellation
updatedSubscription = await stripe.subscriptions.update(subscriptionId, {
cancel_at_period_end: false,
});
}
console.log('Reactivated subscription:', updatedSubscription.id);
return updatedSubscription;
} catch (error) {
console.error('Error reactivating subscription:', error);
}
}
No, only if the first Invoice payment fails.
ok
Hello @gritty forge
Hey there, what's still blocking you from proceeding here? Vanya has explained you cannot restart cancelled subscriptions, and our "pause" functionality is meant to pause payments on a subscription.
https://docs.stripe.com/billing/subscriptions/pause-payment
from stripe docs
You can sign customers up for a free trial of a subscription without collecting their payment details in the Dashboard, the API, and Checkout. When you create the subscription, you can specify whether to cancel or pause the subscription if the customer didn’t provide a payment method during the trial period. To cancel or pause the subscription, set the trial_settings.end_behavior.missing_payment_method parameter when you create or update the subscription:
Pause subscription-If the free trial subscription ends without a payment method, it pauses and doesn’t cycle until it’s resumed. When a subscription is paused, it doesn’t generate invoices (unlike when a subscription’s payment collection is paused). When your customer adds their payment method after the subscription has paused, you can resume the same subscription. The subscription can remain paused indefinitely. Set missing_payment_method=pause to pause the subscription when it reaches the end of a trial without an available payment method.
Where are you finding that, exactly?
I don't have trouble now when I read docs
Vanya says subscription cannot paused so I'm confused
I think it would be more precise to say it cannot be paused directly/explicitly, only indirectly by this one mechanism
A subscription can only enter a paused status when a trial ends without a payment method. A paused subscription doesn’t generate invoices and can be resumed after your customer adds their payment method. The paused status is different from pausing collection, which still generates invoices and leaves the subscription’s status unchanged.
https://docs.stripe.com/api/subscriptions/object#subscription_object-status
This is because it never really starts collecting in the first place, so that can be deferred
In these cases you need to collect a payment method from your customer (and set it as the customer or subscription default) to begin colleting payment
so how to resume pause subscription?
with this api
stripe.subscriptions.resume?