#yurt_subscription-paused
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/1432812111431471265
π 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.
- yurt_ideal-sepadebit, 38 minutes ago, 35 messages
- yurtdweller_api, 3 hours ago, 7 messages
- yurtdweller_api, 4 days ago, 16 messages
- yurt_subscription-invoice, 6 days ago, 34 messages
This is the code that I am working with to resume the paused subscription:
if (subscription.status === 'paused') {
console.log(`Resuming paused subscription.... ${subscription.id}`);
// Resuming a paused subscription will generate an open invoice.
await stripe.subscriptions.resume(subscriptionId, {
proration_behavior: 'none',
});
const invoices = await stripe.invoices.list({
subscription: subscriptionId,
status: 'open',
limit: 1,
});
// The open invoice must be paid before the subscription is resumed.
if (invoices.data.length > 0) {
const result = await stripe.invoices.pay(invoices.data[0].id, {
payment_method: paymentMethodId,
});
console.log(
'Paying outstanding invoice for paused subscription...',
result.status
);
Hello
sorry for the delay
hello
If you unset the default_payment_method from the subscription, does resume work in that case?
Hmm let me check - how do I unset it?
I think you can update the subscription and set default_payment_method: ''
I removed the default payment method on the subscription and replayed the event against my webhook and received the same message
The customer does have a default payment method set as well
π Taking over, just taking a moment to get caugh up.
Hi Mossy! Thanks π
Looks like a rough edge with this particular PM.
Seems the solution is to:
1.) Set up the SEPA payment method, but don't make it the customer's default payment method yet
2.) Call the resume endpoint https://docs.stripe.com/api/subscriptions/resume - this will result in the generation of an invoice in an βopenβ state.
3.) Make the SEPA payment method the customer's default
4.) Call the pay invoice endpoint to pay the open invoice https://docs.stripe.com/api/invoices/pay
Oh interesting.. If I switch the logic for all payment methods to go in that order, should it work?
I am trying to see if this will work as intended
Sorry it takes a moment to get everything together
π Yeah that did not seem to work
req_jeZQMTP2CgWFDA
await resumePausedSubscription(subscriptionId, paymentMethodId);
await saveCustomerDefaultPaymentMethod(
session.customer!.toString(),
paymentMethodId
);
await setSubscriptionPaymentSettings(subscriptionId, paymentMethodId);
await payOpenInvoice(subscriptionId, paymentMethodId);
This is the order I sent the subscriptionthrough
This is the checkout.session.completed event generated: evt_1SNJkaEXjRBPmDmBF6tLHZqC
It looks like the error is saying that the default payment method is sepa, where the work around requires that no default be set until after resume.
You might need to check that there is no default set before testing the flow.
ok, yeah interesting, it seems like somehow the subscription was set to charge the specific method
yurt_subscription-paused
Hi there, I'm still working on seeing what is causing the default payment method to be set
Your code did this on https://dashboard.stripe.com/test/logs/req_KsXdCsTR7CA27s
Oh! Thanks for finding that! I didn't think it was possible for that to happen because I commented it out... maybe it went through anyway. I'm deleting that now and trying again
how were you able to find that request?
Ohhhhhhh I see what is happening. The request is getting picked up by my staging servers! The IP address of that request finally helped me see what is going on
I work at Stripe so I have access to tools internally to pinpoint changes to a given Subscription
and glad you could narrow it down quickly from that!
If I turn off the webhooks for the endpoint, I still should get the webhooks forwarded locally if I'm using the Stripe CLI, right?
yes
ok trying again with it turned off... ha
OK I think that finally worked!