Applying Stripe Discount - stripe-payments

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.

Related

Define a limit on which a stripe subscription invoice is effective or not

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?

How to add a negative line item or an equivalent of a discount in Stripe new checkout?

I have my own shop engine and I use Stripe new checkout for payments, where a customer would be redirected and make payments at checkout.stripe.com.
When there's a discount in an order, I want to be able to simply add a negative line item into an order instead of having to create a discount at Stripe and then apply it to an order. This is because in my shop engine I may apply a discount to shipping, or to a whole order, or to certain products within an order, and it may be difficult to reflect that at Stripe as a discount because discounts at Stripe aren't this flexible. Also I'd have to have my discounts and the ones at Stripe at sync -- more work.
Therefore, I'd simply calculate it and add a negative line, a one with a negative "amount", item on my side.
However, it's not allowed to add a negative line item. What'd be a solution?
You are correct that Checkout line_items must have a positive amount value.
My recommendation would be to instead re-calculate your cart items/total based on any discounts before creating the Checkout session.

NetSuite - Customer Deposit Negative Balance

It seems we cannot enter a negative amount when we want to create a customer deposit record. We have customers who are in overdraft so we need a way to capture negative amount.
How would we do this? We need a way of monitoring billable customer account balance.
Thanks
It might be best to generate a cashsale with an item (service) you set up for overdraft. The amount the customer is in overdraft would be the rate/amount.
You need to show that the customer has a negotiate balance. The only way to really do that correctly is to create a billable transaction, such as salesorder, invoice, or cashsale.

Giving Stripe Customers Credit

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.

Membership subscription using stripe with dynamic plans

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.

Resources