Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you retrieve inactive (cancelled) subscriptions from Stripe

I want to confirm that a customer subscription has been cancelled. The Stripe API documentation only refers to returning "active" subscription. How can I get a listing of all the subscriptions?

Listing subscriptions

You can see a list of the customer's active subscriptions.

GET https://api.stripe.com/v1/customers/{CUSTOMER_ID}/subscriptions

Retrieving a customer's subscription

By default, you can see the 10 most recent active subscriptions stored on a customer directly on the customer object, but you can also retrieve details about a specific active subscription for a customer.

GET https://api.stripe.com/v1/customers/{CUSTOMER_ID}/subscriptions/{SUBSCRIPTION_ID}
like image 707
Barry MSIH Avatar asked Oct 19 '14 12:10

Barry MSIH


People also ask

How do I reactivate Cancelled Stripe subscription?

To reactivate the subscription, update the subscription, setting the value of cancel_at_period_end to false . This prevents the subscription from canceling at the end of the billing period. You can also use the Dashboard's Reactivate Subscription option.

Can you Uncancel a subscription in Stripe?

You can cancel subscriptions through the API or in the Dashboard. Once you open the subscription, you can choose to Cancel subscription in the dropdown menu. When you click Cancel subscription... you will be able to choose when to end the subscription: immediately, at the end of the period, or on a custom day.

What does Cancelled mean on Stripe?

It's just people that didn't finish the checkout. Errors on payment. Some merchants have been worried by errors that appear in the logs when we're communicating with Stripe. These errors are normal and are Stripe's way of responding to bad data like misspelled emails or when the card couldn't be charged.

How do I know if my Stripe subscription is active?

To your actual question, to find any active subscriptions on that customer, you can look at the subscriptions property on the customer response (https://stripe.com/docs/api#customer_object).


1 Answers

As of the 7/06/16 API update:

You can now view canceled subscriptions by specifying status=canceled or status=all when listing subscriptions. In addition, you can now retrieve a canceled subscription by its ID.

https://stripe.com/docs/upgrades#api-changelog

So if you're using the ruby API, for example, you should be able to fetch canceled subscriptions like this:

Stripe::Subscription.all(status: 'canceled')

And get a list of all subscriptions, as you ask for above, like this:

Stripe::Subscription.all(status: 'all')
like image 190
beth9watson Avatar answered Oct 31 '22 17:10

beth9watson