Question about cancellation proration

976 views
Skip to first unread message

brian

unread,
Apr 7, 2015, 6:50:50 PM4/7/15
to api-d...@lists.stripe.com
First I'm sorry if this is a common question, I feel like it is but I also didn't find many resources about it so I thought I'd double check.

When we terminate a user's subscription we'd like to be able to automatically refund them for the rest of the time they're not going to be using the service (so if they have a monthly subscription and we terminate it 2 weeks into the month we'd like to refund them for the second half of the month).

According to the api docs this doesn't seem to be possible:


When you cancel the subscription, the customer's card will not be charged again, but no money will be refunded either. If you'd like to issue a refund, you can do so through Stripe's dashboard or via the API.

and https://stripe.com/docs/api#cancel_subscription only lists a single parameter, "at_period_end", and doesn't mention any way to prorate the rest of the unused subscription period.

So my question is am I just reading this wrong and there actually is a way to do what we want? If not, is this a feature which has been deliberately not implemented or is it something that could be implemented in the future?

Thanks!

Matthew Arkin

unread,
Apr 7, 2015, 6:56:36 PM4/7/15
to api-d...@lists.stripe.com
To my knowledge there isn’t a way to do this directly through the api.

One thought is to downgrade their plan to some free plan, which would result in a negative invoice item for the proration. You could then just cancel the subscription.

You could then get the last charge for that subscription and do a partial refund equal to the amount of that proration invoice item and then just delete the invoice item.

--
Matt Arkin
Kollective Solutions

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at http://groups.google.com/a/lists.stripe.com/group/api-discuss/.

To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Anthony Kong

unread,
Dec 8, 2016, 6:35:38 PM12/8/16
to Stripe API Discussion
It does not work. I can see a negative amount ('credit'). But when I create a new subscription, a new charge is made instead of using the credit.

The switching to a zero-cost subscription also created a line item on invoice which may look confusing to the customer

Remi J.

unread,
Dec 11, 2016, 11:45:46 AM12/11/16
to api-d...@lists.stripe.com
Hey Anthony,

Sorry for the delays here, it's been a crazy week. I'm not following exactly what you're describing so I'm not sure how to reproduce. If you downgrade a subscription to `quantity: 0` it would automatically create a credit that would be added to the customer's account balance. It would then be used automatically on future invoices when you subscribe the customer to a new plan.

We have some detailed documentation around proration that I'd recommend you to read here: https://stripe.com/docs/subscriptions/upgrading-downgrading

Otherwise, you should talk to our support team directly to discuss your exact needs and what isn't working. If you provide concrete examples of both your code and what you saw in the dashboard, they should be able to tell you exactly what you're missing!

Happy Sunday!
Remi

To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.

Anthony Kong

unread,
Dec 11, 2016, 11:06:52 PM12/11/16
to api-d...@lists.stripe.com

Hi,

I read the url you referred to again but I can't find any mention of setting quantity to 0.

Actually it is mentioned in another section: https://stripe.com/docs/subscriptions/canceling-pausing

But the wording is extremely confusing to me. Here I quote:  "To determine how much a customer is credited by canceling a subscription, use the proration preview concept, setting the quantity to 0 to replicate no subscription."

Does it means "To determine how much a customer is credited" I have to take 3 actions (cancel a subscription, use proration, set qty to 0) in sequence?

Or it means "To determine how much a customer is credited by canceling a subscription", I should 'use the proration preview concept'? Then what does the phrase 'setting the quantity to 0 to replicate no subscription' mean here? Because as far as I can work out, 'proration preview' is referring to the upcoming invoice concept (https://stripe.com/docs/subscriptions/invoices#previewing). In this part of documentation I did not come across any discussion of setting quantity to zero.

I am simply  unable to find adequate documentation about to use 'set the quantity to 0' method.

When I tried it out, I find this issue:

After I set the qty of a subscription to 0, a line item is created as expected. But the moment I delete the subscription, the line item is also removed. ie. the customer will lose the credit. If I create a new subscription of a different plan now, the customer will be charged a full amount.

But logically it is how I want the events to happen: Work out the remaining credit from old subscription, cancel old subscription, then create a new subscription which will make use of the credit.

How would you suggest to handle this? 

Remi J.

unread,
Dec 12, 2016, 7:48:36 AM12/12/16
to api-d...@lists.stripe.com
Hey Anthony,

We don't do proration on cancelation which is why you're seeing this behaviour. What you should do is follow those steps:

1/ Preview the upcoming invoice with a downgrade of the quantity to 0. This tells you how much credit the customer would get but it doesn't change anything, it just helps you preview it or know in advance.
2/ Cancel the subscription.
3/ Update the customer and set their credit on their account balance so that it can be used on future invoices or subscriptions automatically.
4/ Create the new subscription which automatically uses the credit.

Separately, if you already plan to create a brand new subscription, you should be able to have all of those steps happen with just one API request instead. You would simply call the Update Subscription API [1] and pass the new plan id in the `plan` parameter. Doing so will automatically calculate the proration for you of how much credit you owe the customer for the subscription he's canceling and how much the customer owes you for the new plan so that you end up charging exactly what's expected.

Cheers,
Remi
Reply all
Reply to author
Forward
0 new messages