Starting a subscription with a prorated period

515 views
Skip to first unread message

Aaron Michal

unread,
May 31, 2017, 10:18:28 AM5/31/17
to api-d...@lists.stripe.com
I feel like i'm missing something obvious.

I need subscriptions to renew on a fixed schedule but start with a prorated amount for the remaining part of the current period. For example.

Plan A is billed monthly on the 15th of the month for $100
A customer signs up on the July 1st.

There were 30 days in june so I want their first invoice to run on June 1st for the remaining 15 of those 30 days. The amount would be (15/30 * $100)=$50

And their next invoice should run on June 15th for $100 (and the $100 on each 15th of the month after that)

I've read https://stripe.com/docs/subscriptions/billing-cycle and tried various combinations craeting the invoice with and without a trial_end and updating it with a new trail_end with both prorate=true and prorate=false. I even tried playing with proration_date:


subscription = stripe_customer.create_subscription
subscription.proration_date = next_billing_date
subscription.trial_end = next_billing_date
subscription.save

This seems to create 2 invoices
* an invoice for the full amount
* a second invoice with two line items
   - one for $0 and 
   - one for a credit but with the a description that makes no sense "Unused time on <plan> after <now>"





Jonathan Lomas

unread,
May 31, 2017, 1:40:28 PM5/31/17
to api-d...@lists.stripe.com
Hi Aaron!

Thanks for reaching out - I'm sorry you're having issues with this!  I think your best bet here is a two-step approach making use of the Invoice Item [0] to handle that initial charge:

1) Create an Invoice Item on the Customer [1] to cover off the first billing amount; and
2) Create the Subscription with the `trial_end` date set to the next billing date (i.e., June 15). [2]

As long as you create the initial Invoice Item before creating the Subscription, that initial Invoice Item will be picked up - and paid - when creating the Subscription.

This means that as soon as you create the Subscription, the customer will be billed for that initial amount - i.e., the Invoice Item - and then they won't be billed again until the `trial_end` date - i.e., the 15th of the month.

Hopefully that'll get you moving forward; if not, or you run into any other integration issues, don't hesitate to let me know!

Best,

Jonathan

[0] https://stripe.com/docs/api#invoiceitems
[1] https://stripe.com/docs/api#create_invoiceitem
[2] https://stripe.com/docs/api#create_subscription-trial_end

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.
Reply all
Reply to author
Forward
0 new messages