Adding a Setup Fee to a New Stripe Subscription

For those of you not familiar with Stripe, it is a payment processing service that makes it super easy to accept credit cards on your website without worrying about all the ugly PCI compliance bits that cost a lot of time and money. In addition to one time transactions, Stripe offers subscription billing and management in a way that makes a lot of sense. The only that that is missing from the subscription system is the notion of a setup fee. In my mind, it isn’t super obvious how you would create a setup fee with a Stripe subscription and I didn’t find a good explanation from anywhere else, so I thought I’d take a crack at it.

From my perusal of Stripe’s documentation, this is how you would create a setup fee for a subscription:

  1. Setup Stripe Checkout on your website to accept a user’s credit card details and receive a token
  2. Post that token to your web app
  3. Create a customer using the token that you received from Stripe
  4. Create an Invoice Item for your setup fee and associate it with your customer but do not pass anything as the invoice parameter
  5. Update the customer’s subscription to whatever subscription plan they signed up for

If you weren’t applying a setup fee to the user’s account, you could create the customer and assign them a subscription at the same time. However, because the initial subscription invoice is charged immediately upon creation, you need to make sure the Invoice Item for the setup fee already exists. That’s why you create the “dangling” Invoice Item – it will automatically get assigned to the next invoice. The next invoice just happens to be the one that starts the subscription for the user.

6 thoughts on “Adding a Setup Fee to a New Stripe Subscription

  1. Ben Buie

    What if you have a trial with your subscription? Will the setup fee be charged at plan creation or at the end of the trial? I’d prefer the former, but I’m thinking it does the latter.

    Also do you have any experience with manually setting the trial end date? We will have a “introductory period” where the trial end date is fixed at October 31st (so the earlier you sign up, the more free time you get).

    Thanks,

    Ben

    Reply
    1. Nick Ohrn Post author

      Ben, I’m not really sure as I haven’t encountered those situations. While I’m implementing this today I’ll take a look and reply back here with any information I find related to those things.

      Reply
    2. Nick Ohrn Post author

      I read through a bit more of the API documentation on Stripe.com and it appears that the setup fee (if done the way I describe above) will be charged only at the end of the trial. If you want to charge the customer an amount immediately but only have them charged for the subscription starting with at the end of the trial, it appears you’d have to make a one time charge either via the Charge API object or by creating the invoice item (as specified above) and then creating a new Invoice object.

      Let me know if that works for you!

      Reply
      1. Rick

        Google directed me here, just wanted to say thanks for sharing your findings, I was planning on doing a setup fee that charged immediately and then the monthly subscription started x days later.

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *