#Miroslav
1 messages ยท Page 1 of 1 (latest)
Good question. Checking in to whether it is possible to differentiate like this and will get back to you
From my experience, there's actually no "automatic/key" ways to know it.
I'm using cancellation_details.comment for such things.
You can also use metadata and/or checking the invoice , if it's unpaid / uncollectible, there's a chance cancellation is linked to a non payment.
Yep yep, that is the conclusion that my colleagues and I came to. You can pass a comment when cancelling via the API to be able to differentiate between that and the others https://stripe.com/docs/api/subscriptions/object#subscription_object-cancellation_details-reason
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Still trying to find how to tell if it is because of missed payments
Using node wrapper, when receiving the webhook, I'd do a
const sub = await stripe.subscriptions.retrieve(id, {
expand: ['latest_invoice'],
});
```
and check its `(sub.latest_invoice as Stripe.Invoice).status`
the link you sent for the "cancellation_details.reason" enum, it has "cancellation_requested" and "payment_failed" values. Can those be used?
Yes they can, apologies I misunderstood what that field was a bit. payment_failed is how you would tell the subscription is being cancelled for nonpayment
but comment is a freeform string ๐
@still wigeon are there 7 possible values of that enum? I see 3 on the link ๐
Oh wow, the cancellation_details.reason is new.
The seven (actually 8) was for cancellation_details.feedback my apologies
So @wooden warren was right ๐
Nice, thank you guys! I'll test this reason and see if it fulfills all the requirements. I may also need to differentiate between the member cancelling his own account and the admin cancelling immediately. But as I can say to admins to always use my app for those actions (and don't go directly through the Stripe portal), I'll be able to store some info of the intent on our side.