Stripe Refund Prorated on Quantity of Days Subscriptions - stripe-payments

My goal is this: sub service started to experience issues on 11/9. Instead of pausing payments immediately, I let a few weeks go by. I now want to refund the cost incurred to each user based on the prorated cost for the number of days of bad service. So refund each user 19 or 20 days based on their current subscription. Is there a way to do this via API?
It get's so complex with the past month's proration on the bill. It's a nightmare and this would save me so much time. Willing to compensate. Thank you.
I havent been able to try anything yet.

You can issue a partial refund by specifying an amount less than the original amount of the payment being refunded using the Stripe API. You would specify the payment_intent belonging to the Subscription Invoice in question (which you can find on the Invoice object).
However, you need to calculate the amount you wish to refund on your end based on the amount you want to refund for each Subscription.

Related

I want to deduct payment on the basis of request used in previously subscribed subscription when user upgrades in stripe?

I am working on stripe subscriptions and have 2 packages basic(400 requests)/month and premium(800 requests)/month and charges 10$ and 20$ respectively. when a user upgrades a subscription, I want to charge a user on the basis of request used. but stripe provides prorated approach and without prorated approach. in prorated approach it calculates payment on the basis of time spent in previously subscribed subscription and remaining time in newly subscribed subscription. but I want to calculate amount to be deducted from my own calculation because it might be possible that the user used only 2 requests in the first 15 days and then upgraded the package. however, I can use usage based pricing model but in this case I have to tell stripe each time that the user requested so increment the count and also stripe has rate limiting per second. how can I achieve it? thanks
I have tried to implement it with stripe schedules
Your best bet is the Usage based pricing model indeed. Read its Doc carefully or the Pricing Model Doc. Avoid Proration in your case, and make sure to report usage to Stripe.
Rate limiting is a different problem and you would need to deal with it regardless of APIs you are calling.

How can you pre-auth a subscription payment with stripe (after the first payment)

I know I can pre-auth a stripe subscription with a trial period. I want to pre-auth the 2nd, 3rd, 4th, nth subscription payment. The info we are sending out is time critical and if their subscription lapses due to NSF or something else, it would be nice for them if they could rectify the problem BEFORE it lapses.
There is a pending invoice you can get for a subscription, and you can create a payment intent with an invoice ID so that when the invoice is paid, the payment intent (that captured the money) will be used to collect the money. BUT the pending invoice doesn't have an ID until one or 2 hours before they try to collect the money which is 3-4 days too late.
Has anyone figured out how to pre-auth subscription payments other than the first one?
Is there a subscription engine I could use (with stripe/paypal/venmo) that would mean I could quit using the deficient stripe subscription system?
Subscription invoices don't exist until the renewal of the billing cycle, and the underlying payment intent is created by the invoice. It's not supported to "pre-auth" subscription payments. Instead, you need to handle payment failures when those occur, optionally by letting Stripe handle that for you.
If you want to have successful payment in advance of some time-sensitive event, then I'd suggest one of two alternatives:
Shift your billing cycle to invoice 3-4 days ahead of what you have set now, allowing you time to recover from payment failures before the delivery timing.
Alternatively you would implement your own recurring payments using saved payment details. You would similarly want to authorize the payment ahead of time to allow for recovery. You could optionally use manual capture to defer capture until the time of delivery.

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 :)

Stripe subscription upgrading and downgrading.

This question is for anyone who's experienced with Stripe. I've run into a situation that may be pretty specific, but I'm hoping I could get some help with. I am creating a system where a user can pick from many different options and set up a yearly subscription based on their selections. So there is no set plan cost, the subscription cost is variable.
Now, if someone creates a subscription for $100.00 dollars, then in a month decides next year they'd like to reduce their subscription to $50.00 they can do so. However, they will not receive a prorated refund due to the downgrade for the current subscription period. My issue is, let's say they change their mind and realize the $100.00 service is worth it. So much so they actually want to change their subscription from $50.00 to $120.00 in the current subscription year. I would like to charge them a prorated fee, but if I do that they will be charged for the difference of $50.00 and $120.00, not $100 (which they paid originally) and $120. Is there anything I can do to allow for such a situation to occur?
I'm thinking that in order to make this work I'll have to implement the calculation of a proration amount myself. So in the case a user pays for a $100 subscription, downgrades to $50, and then sometime later in the same year upgrades to $120.
The solution I see is to save the maximum amount they've paid for their subscription in my local database record. When they upgrade, if their new plan cost is greater than the maximum they've paid, I need to set their stripe subscription to the new amount without proration, then calculate the difference between the max they've paid and the new plan amount, prorate the cost and charge them manually using a stripe charge. Kind of a roundabout way to do it but it accomplishes the goal as far as I can see at the moment.

Resources