Using the Stripe API to allow a free trial of a single product in a multi-product subscription - stripe-payments

We have three products, small, medium and large. I'm using the Stripe API to charge customers on a prorated for each product they use every month.
I'd like new customers to be able to have a free 14 day trial of the first small product they add to their subscription.
Picture a VPS company allowing a free trial of their small VPS, but wanting to charge if a customer adds a medium and large one in the first month.
The problem I'm encountering is that free trials apply to all products in a subscription. If I use the trial_period_days attribute when creating a subscription or a checkout session, that applies to all products in that subscription for that month. i.e. customer adds a small product, then adds 100 large products, and receives all of them for free during the trial.
I've tried looking into coupons as an alternative, as in applying the cost of a small product to a customers subscription, but if they remove a product at any time from the subscription, the pro-rated refund excludes the coupon, and so the amount vanishes.
Is there any way to use the Stripe API to product the first product only with a free trial; while still only having one recurring subscription?

Related

Best way to model my mixed monthly/yearly subscription with Stripe payments

The subscription plan
I have a subscription plan available at my app which I need to model with Stripe.
The subscription plan details are the following:
A fixed amount of $20/month or $200/year (discounted) that the user must pay.
With the previous fixed amount the user can consume 2500 units of the product per month.
If the user consume more than 2500 units in one month every additional unit has a value of $0,01.
Examples
A user choose the subscription plan with the $20/month option and in the first month he/she consumes 2520 units.
The total amount to pay for the first month of the subscription for this user is:
$20 fixed amount
20 additional units * $0,01 = $0,2
Total to pay: $20 + $0,2 = $20,2
A user choose the subscription plan with the $200/year option. In the first month he/she consumes 500 units. In the second month he/she consumes 5000 units.
For the first month this user needs to pay:
$200 because is starting the subscription
No additional units.
Total to pay: $200
For the second month this user needs to pay:
No fixed amount because the fixed yearly quantity has already been paid.
2500 additional units * $0,01 = $25
Total to pay: $25
Problems
My biggest problem modeling this with Stripe payments is that is not possible to have prices with different intervals in the same subscription.
If the user chooses the yearly fixed price is not possible to create a subscription on Stripe that has a fixed yearly pay (of $200 in this case) and a monthly graduated price (for the additional consumed units).
I have seen that the subscription upsell feature is something very similar to what a I need. But once it's activated I can't find any way on the API to enable it when the subscription is created (I'm not using checkout).
I have seen also that it's possible to create two subscriptions, one for the yearly pay and another one for the monthly units. But creating two subscriptions make everything really difficult, you need to take into account two subscription states and callbacks are more difficult this way too.
Questions
What is the best and simple way to model this subscription plan using Stripe?
Note: I'm doing a custom integration with Stripe, so the subscriptions and customer are created via API. I'm not using Stripe checkout.
My biggest problem modeling this with Stripe payments is that is not possible to have prices with different intervals in the same subscription.
Indeed, you can't combine Price objects with different intervals on a single Subscription. Otherwise, this pricing is possible by combining a flat rate fee with metered usage as outlined here.
Your best option in cases where your customers elect for the annual fixed fee is to roll with a single usage based Price and amend the initial invoice to include that a one-off Invoice Item for the annual fixed fee.
I have seen that the subscription upsell feature is something very similar to what a I need. But once it's activated I can't find any way on the API to enable it when the subscription is created (I'm not using checkout).
Subscription upsells are a Checkout only feature right now. However this is not really related to the problem you're facing (it just provides a UI for your customers to upgrade to an annual Price for the same Product).

Is it possible to alter a recurring price that an existing customer is charged with Stripe API?

If an Express Connect Account holder creates a Product with a Recurring Price of say $10/month. And a customer signs up for this, a Subscription is created and Stripe will automatically bill the customer $10/month until they cancel. So here is my question...if the Connect Account holder wants to increase their Price from $10/month to say $12/month...can they do this such that the price increase will be billed to existing customers as well as new customers? I am thinking of an example where the Connected Account has say 100 existing subscribers, so manually changing each one, doesn't really work. Looking for something automated. From what I have read, it seems, that only new customers will see the new $12/month Price, and existing customers will see the original $10/month price until they cancel. Is this correct? Seems odd that Stripe would have no way of allowing Connect Account holders a way to increase their recurring Prices for existing users. I get they can create a new price..and hope users voluntarily switch to the new high price, but that seems odd.
You would want to think Subscription as per-customer object. Let's say you have 100 existing Customers already subscribed to a $10 monthly plan, there are 100 existing Subscriptions object, tights to each of those Customers.
Now if the Connected Account created a new price of $12/month, all new Customers will subscribe to this new price, and create separated new Subscription objects.
If you want to upgrade the currently existing Subscriptions, you would need to update each of them, changing the old price to the new price, by Stripe's Subscription Update API. Make sure to read the note about Proration, or refer to Proration Doc

How to reset monthly SaaS usage on an annual Stripe plan?

I am currently in the process of creating the billing system for my first SaaS. A simple tool to generate videos. There will be a free, mid, and pro tier. The main difference will be the number of minutes you can generate per month.
I created 3 Stripe products for the tiers. The free product consists of one price ($0) with a monthly charge interval. The mid and pro tier consists of 2 prices, a monthly and annual charge interval.
When a user signs up for an account, my backend automatically creates a Stripe customer and subscribe it to a free plan. A user can upgrade their account to a mid or pro tier. The plan will be downgraded to a free tier when the user cancels or if the payment failed.
I reset the number of available render minutes after each successful payment, at the start of the billing month. I do this by listening to the successful payment Stripe webhooks. Even when the user is on the free tier, the webhook still gets fired since it is a plan.
The problem is that this method would not work for annual plans.
Which made me think that the method that I went for may not be the correct one.
Do you know if this is a good method if there is a better one and if there is a workaround for annual subscriptions?
Thank you very much for your time.
I think for the annual billing you'll likely want to just set up a cron job or similar that runs daily, and that looks at which annual subscriptions' 'billing day anniversary' (i.e., billing date is Aug 7, so billing day anniversary is the 7th of each month) and resets the counts - unless it is the billing date, in which case leave it to your webhook.

Recurring billing with Stripe - will Subscriptions suffice?

My application allows a customer to purchase credits for later in-app use.
I want to enable customers to buy credits throughout the month, and only get billed at the end of the month.
Should I be using a Stripe Subscription at an amount that equals the price of one credit, and change the quantity according to the number of credits the customer purchased?
(After a successful invoice - I'll reset the subscription quantity to 0)
Is there a better solution? Perhaps some clever method of using Stripe Checkout?
Your proposed approach sounds reasonable.
I've not tried it but an alternative I can think of would use a free plan and the Invoice Items part of the API.
Create a free plan with amount with amount field set to 0. As far as I can see from the docs, all the subscription lifecycle webhooks should be triggered for Customers who're subscribed to the plan.
Through the month, create InvoiceItems for the Customer. According to the docs, at the end of the billing cycle, those InvoiceItems are added to the customer's invoice.
Sometimes you want to add a charge or credit to a customer but only actually charge the customer's card at the end of a regular billing cycle. This is useful for combining several charges to minimize per-transaction fees or having Stripe tabulate your usage-based billing totals.
Beyond that, you'll want to consider if you should have Stripe generate/email your invoices.
I don't think this is the way to go, because subscriptions are billed the first time among other things.
The recommanded way is: stripe doc: Place a hold on a card
summary
You first ask authorization for a certain amount (the max amount). Eg: 1000$
Your custommer buy 50 credits in the month
At the end of the month you charge the customer for 50$ (it can not be greater that the maximum you authorized in the first step)
That's all :)

Google wallet annual recurring subscriptions?

According to the documentation Google Wallet seems to only support monthly recurring subscriptions.
I'd to charge users annually for the use of an application hosted on AppEngine (purely to be able to offer the user a better price and reduce administrative costs). Are there any plans to support annually recurring subscriptions?
Or is there a way to configure the current subscription system to behave as an annual subscription system?
Technically there's no way to configure an annual subscription. But I suppose you can work around it: Request an initial payment for the entire first year and then a monthly-recurring payment at a discount.
For example, suppose you offer a monthly plan that costs $100. And you want to offer an annual plan for $900 (25% discount). Instead, you may offer an initial payment of $900 followed by 36 monthly-recurring payments of $75.
What this means for your business is that once a user has paid for and used your service for an entire year then you start treating her as a "loyal customer" and let her keep paying the discount price without committing for another year.
Wallet for Digital Goods currently only supports a monthly frequency for subscriptions.
https://developers.google.com/commerce/wallet/digital/docs/jsreference#jwt
there is no official solution for an annual subscription, but you could implement a solution similar to what #oferei or #EdSF suggested in their posts.

Resources