#Miroslav

1 messages ยท Page 1 of 1 (latest)

harsh trellisBOT
wooden warren
#

Good question. Checking in to whether it is possible to differentiate like this and will get back to you

still wigeon
#

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.

wooden warren
#

Still trying to find how to tell if it is because of missed payments

still wigeon
#

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`
limpid pike
#

the link you sent for the "cancellation_details.reason" enum, it has "cancellation_requested" and "payment_failed" values. Can those be used?

wooden warren
#

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

still wigeon
#

but comment is a freeform string ๐Ÿ™‚

limpid pike
#

@still wigeon are there 7 possible values of that enum? I see 3 on the link ๐Ÿ™‚

still wigeon
#

Oh wow, the cancellation_details.reason is new.
The seven (actually 8) was for cancellation_details.feedback my apologies

#

So @wooden warren was right ๐Ÿ™‚

limpid pike
#

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.

harsh trellisBOT