We use stripe for our payment gateway.
We have X products in different currencies that we want to keep for subscription. The user can choose any combination of these X products and pay the membership price (monthly) and use the combinations they have opted for.
Therefore the plan can be any random number with the currency that the customer opts to pay for. The cost for monthly plan will be generated once the user chooses the product. For eg: when choosing 2 different products only the pricing can be X1 + X2 = X3 which could result in any number $5.9, €10, £99.89 etc.
How are plans created in such cases which can handle multiple currencies?
There are couple of options to do this but I am looking for a very elegant way to solve this problem
Options 1:
Creating a plan on the fly can be one option but there will be one plan per customer which will end up being too many plans and eventually clutter up the dashboard.
Option 2:
Stripe also provides a quantity option but not quiet sure it will be very helpful in this case.
What I usually recommend here is to build the logic on your end instead. You keep track of the "plans" the customer is subscribing to so that, each month, you can modify their invoice and charge them the expected amount. The idea is to subscribe all customers to a $0 plan so that you decide that amount each month.
For this, you'd use Invoice Items that can be added to an invoice and appear as a line item on the email receipt. You would then use Stripe's webhooks to be notified about events that happen in your Stripe account. That way you can listen for the invoice.created event and create an invoice item for this invoice to change the amount billed to this customer. You could also create multiple items (one per plan) to clearly outline what's being paid.
You'd need to follow this flow:
Create a customer in Stripe with the card token.
Create the first Invoice Item(s) for the first invoice (always closed by default).
Create the subscription to the $0 monthly plan => automatically bills the Invoice Item(s) created before.
Each month, listen for the invoice.created event and create new Invoice Item(s) for the correct amount.
The caveat is that you have to handle proration on your end in that case but that allows someone to add an extra option without having to figure out how to move them to a new custom plan and all that entails.
Related
I have little experience with payment gateways, and am trying to figure out how to synthesize the type of subscription billing that I am looking for: the monthly price gets rebalanced once a year, based on another attribute (a number that can get as high as seven or eight digits).
So, for example, the monthly subscription price as of January 1st will be a % of a user's credit card debt balance as of Dec 15th in the prior year. But the debt balance can get very high / does not have a cap.
I looked at the Stripe documentation to figure out of there's a way to do this. The only thing I could come up with is to use unit_amount in metered pricing and tying this to the credit balance. In other words, I would grab the debt balance number and use it as the unit_amount, and then apply a %. But then I need to also forward bill, so I trick the logic into shifting by a month, which seem impractical.
Alternatively, I am not sure I could do this with per seat pricing (e.g. $1 in debt = 1 seat). But I assume there's a max to the number of seats (i.e. someone cannot have, say 1m seats). I just couldn't determine this from the documentation...
That's what I was thinking, anyway. Perhaps there's a better way?
You've got a couple different options here:
At the start of the year you update the Subscription to a new price based on the calculations of the customer's credit card debt balance by specifying items[0].price_data. Setting items[0].price_data (see the api ref) allows you to create an "in-line price" that as part of the updating the Subscription, so you don't have to create one separately through a separate API request. If you haven't seen Stripe's docs on how to update the price of a Subscription you can see an example here, and you'll likely want to read about proration_behavior as well.
You have a single Price where 1 seat = $1 in debt, and you control how much you want to charge by changing the number of seats for the Subscription. I don't think Stripe has a limitation to the number of seats (as long as it's a valid integer), but they do have a limitation on the maximum amount you can charge which you can read about here. For USD the maximum charge amount is $999,999.99, so the maximum quantity would be you could specify for a $1 price is 999,999.
You could look into using metered pricing, but given that you don't want to bill at the end of the billing cycle the other two options seem better.
I think the first option (updating the price year by year) is your best one, but definitely try all of them out in test mode and take a look at how the Invoices look to see which one you like best.
I am working on a Stripe integration for a user with some very specific rules for a yearly subscription plan on Stripe:
If the user starts the subscription between 2022-01-01 and 2022-09-30, they shall be charged the full amount immediately and next on 2023-01-01 - From then on, the charge will be yearly
If the user starts the subscription between 2022-10-01 and 2022-12-31, they shall be charged the full amount immediately and once again on 2024-01-01 - From then on, the charge will be yearly
My immediate guess is that case #1 should be possible with a combination of backdates, anchors, no-prorate and/or trial periods, although I haven't tested the specifics yet.
How can I implement case #2, when the anchor for the next charge is in more than 12 months? To my knowledge, Stripe disallows anchor dates that are further into the future than the next natural billing date (which is 12 months for a yearly subscription). It is also not possible to have a trial_end later than the anchor date.
I am using Laravel Cashier/PHP on the backend, but I doubt it comes out-of-the-box, so I am merely looking for the API options for creating the subscription in any language.
You can achieve your first scenario by setting backdate_start_date to 2022-01-01 and billing_cycle_anchor to 2023-01-01.
As you note, Stripe does not allow billing periods of longer than 12 months but there are some workarounds for it.
One option is to create a subscription with a year+ long trial but with a one time charge of the subscription's yearly fee. To do this when creating the subscription you would backdate the start date to 2022-01-01, set a trial_end and billing_cycle_anchor of 2024-01-01, and use the add_invoice_items[1] parameter to create a one time charge with the same amount as your yearly fee.
Alternatively you can create a subscription schedule[2] with a first phase that ends 2023-01-01, a trial phase that lasts a year, and then a phase with your year-long price.
[1] https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
[2] https://stripe.com/docs/billing/subscriptions/subscription-schedules
I've been using Stripe to start subscriptions for my clients recently and I have a specific issue.
I have a metered price for a product that's let's say 0.09€ per item (an SMS in that case) on a monthly cycle. Since you pay on Stripe for your invoices, I'd like to define an amount limit to have this invoice sent or not. For example, let's say this amount is 10€ and the the pending invoice amount at the end of the month for a user is 5€, I'd like to carry these 5€ over the next month.
I read about the billing_thresholds.amount_gte which does basically the opposite of what I need from what I understand.
Is this possible?
Does anyone know if there is another way to implement discount in stripe subscription without using coupon stripe features.
I have a feature in my application that admin users can give different discount amount to a subscribe user every month.
Is there a way I can edit the "Upcoming Invoice" amount of the customer through stripe api.
You can never directly edit the total amount of an invoice -- it is automatically calculated from the sum of the values of each line item, taxes, coupons, etc.
If you don't want to use coupons for whatever reason, another thing you can do to reduce the amount of an invoice is to create invoice items with a negative value.
I'm working with Stripe. Our users subscribe to our service and they are billed every 2 weeks. We need to implement a way to give them $5 credit every time they refer someone to use our service.
Solutions I have considered so far:
Stripe coupons: Stripe has great documentation. Unfortunately, for
coupons there are many ambiguities. I tried working with coupons but
so far it seems like a coupon can only be applied once for each
invoice, and you can't apply multiple coupons for one invoice. This will not work with us since a user can earn $5 multiple times during the billing period.
Issuing refund: the problem with this is that we have to pay the user actual money while what we actually want is to give them credit to use in our service.
Am I missing anything with coupons? Are there any other solutions/suggestions?
If I understand your use case correctly, I think the best way would be to create an invoice item with an amount of -500 for each referral. When you create an invoice item, by default it is set as "pending" and will automatically be included in the next invoice, i.e. at the end of the current billing period.
Be aware that if the invoice's total is negative (in the case of many referrals), then the total will be added to the customer's account_balance and reduce the amount of the next invoice as well. If this isn't what you want, you'd need to reset the customer's account_balance to zero, or make sure that you don't create invoice items that will make the invoice's total go below zero.
More information about invoice items can be found here: https://stripe.com/docs/subscriptions/guide#adding-invoice-items. The guide only mentions invoice items with positive values (i.e. additional charges), but you can use negative values as well.
Have you considered just checking for available credit in transactions before you charge?
That way you can just store how much credit people currently have in some database, and just apply the balance on transactions. AKA charge them for full_price - total_credits.