#yonatan
1 messages · Page 1 of 1 (latest)
hello! can you share the Invoice id where the customer was charged outside of their billing cycle?
this is the customer id: cus_O2GvqIXNUxF5nk
sure, invoice id: in_1NGahyCWcHXwVLZTubtJe2zN
gimme a second to look into this
so the invoice was generated when your customer cancelled the subscription via the Customer Portal. What's odd is that you specified proration_behaviour as none when you configured the cancellation behaviour for the customer portal, so I wouldn't have expected it to prorate any existing usage.
This is going to take some time to look into, can you write in to https://support.stripe.com/contact/email with the object ids and mention what I said? We'll look further into this and get back on the ticket
I sent the details through the link you shared
alright, we'll get back to you after looking into it!
is it happens again with other users, both users disabled their subscription through the billing portal
I think that what happens is that stripe cancels the subscription, and only then creates an invoice and charge the user for any outstanding payments
the problem is that in the docs it says to listen to 'invoice.paid' event to activate the subscription internally, but the problem is it is sent after the subscription is cancelled, and causes activation of a cancelled subscription
sorry, i'm not sure i understand this correctly - so when a subscription is cancelled, you're listening for the invoice.paid event and doing something?
I'm always listening to this event, in docs it says this event indicates the subscription is started (when you first create a subscription), the problem is I didn't expect to receive it after a subscription is cancelled
maybe I'm confusing with 'checkout.session.completed'
shouldn't I listen to 'invoice.paid' ?
if you want to narrow down the criteria to when only the subscription is started - you can check the billing_reason also - https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
an invoice.paid event would be generated whenever an invoice is paid
if someone has a filed invoice of a recurring payment, I'm getting 'invoice.payment_failed', and pausing their subscription internally
if they pay the invoice, I want to reactivate their subscription, to which webhook should I listen?
You'd listen for invoice.paid
but then it is also sent after the subscription is cancelled
Sure, that can happen as invoices can still be paid even after cancellation. You'd need to void any open invoices when you delete/cancel the subscription
what? it doesn't make sense
What doesn't make sense?
the invoice is created after the subscription is cancelled because there is some extra payment to be made
I cant delete/cancel it
I will loose payment that should be made
Then I'm not sure what you're asking me then. You'd listen for invoice.paid events as advised
as discussed above, a user cancels their subscription, and after it an invoice is paid with all the extra charges (if any)
in that case I get invoice.paid , but the problem is the subscription is cancelled. I'm listening to invoice.paid in cases a subscription is not cancelled, and a recurring invoice is paid
I want to see the subscription invoices are being paid and keep the subscription active internally
but if I get it after the subscription is cancelled it leads to marking a subscription as active even though it is cancelled by the user
Then you'd use the subscription field on the invoice.paid payload check the status: https://stripe.com/docs/api/invoices/object#invoice_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and what should I check there?
I guess you'd check status if you want to know whether the Subscription is active or canceled: https://stripe.com/docs/api/subscriptions/object#subscription_object-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
if a payment fails, what will be the subscription status?
Depends on your Dashboard settings, but generally past_due: https://stripe.com/docs/billing/subscriptions/overview#failed-payments
it says there "you can set the subscription status" how do I do that? through the api?
No, it can't be manually set. It's referencing the settings here: 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.
it says in the settings that if all payment retries fail it marks the subscription as canceled, what will be the subscription status while retrying ?
It'd persist the current state
ok, thank you for the help!
sorry another question - if all retries fail, and the subscription is marked as cancelled, will I get the customer.subscription.deleted event?
Yep!