'Stripe API - provide the reason for subscription cancellation

In Stripe's UI there's the REASON column:

enter image description here

As per Stripe's docs, it's possible to cancel a subscription via API:

var stripe = require("stripe")("sk_test_J7rbZuZ0bLvmPVnuEKPFnIEC");

stripe.subscriptions.del('sub_49ty4767H20z6a');

Now, how can I pass the cancellation reason (provided by a user) to Stripe's API?



Solution 1:[1]

While it is possible to cancel subscriptions you cannot currently set a reason.

The reason displayed in the Stripe Dashboard is a (currently) internal-only cancelation code of either "Unpaid" or "Canceled".

"Unpaid" when the subscription has been canceled due to failure to collect payment by Stripe Billing's engine, or "Canceled" when you, the admin user, has manually marked the subscription as canceled.

Solution 2:[2]

FWIW, you could add this as metadata against the subscription object. Metadata is available on most objects in Stripe with key/value pairs: https://stripe.com/docs/api/subscriptions/object#subscription_object-metadata

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kiwi
Solution 2 iamkeir