Stripe subscription set billing date as first of each month - node.js

I'm using Stripe Checkout flow to collect the users' payment details and automatically collect the subscription. I have also implemented webhooks to listen to checkout.session.completed so that I can edit the subscription. What I want is as follows:
Say, the user registers on January 15th. I'm using metered billing, so the user pays $0.00 on the first invoice.
In webhooks, I apply a trial period of 7 days to the subscription like so stripe.subscriptions.update([id], {trial_end: [seven_days_into_future]}). So the billing anchor date on the subscription becomes the 22nd of each month.
However, I would like to set the billing anchor date as the first day of each month. So I would like the user to receive the first invoice for January 22-31 (prorated), and then get invoices for full calendar months onwards.
How do I achieve that?
I cannot set the billing_cycle_anchor to the desired date because it accepts only now and unchanged values...

If you're working with already created subscriptions, then you'll need to add trial periods to shift the billing_cycle_anchor:
https://stripe.com/docs/billing/subscriptions/billing-cycle#using-a-trial-to-change-the-billing-cycle
If you know exactly how you want to structure your trial and billing_cycle_anchor at the time the subscription is being created, then you can future-date the billing_cycle_anchor during creation:
https://stripe.com/docs/billing/subscriptions/billing-cycle#new-subscriptions

Related

How to give discount on new Stripe subscription?

We have a free subscription concept separate from Stripe. When a user signs up for a paid subscription we want to charge them immediately but still honor any remaining free-period.
I know I can use trial period to delay the start of the Stripe subscription, but we wanted to charge immediately to confirm valid credit card details. Is it possible to give a discount on a new subscription instead, to account for the users remaining free-time?
For example, if
today is the 1st
user has free subscription until 15th
monthly subscription is $10
I would like to charge them $5 today and immediately begin their subscription in Stripe with a Stripe renewal on the next 1st.
Easiest way to do this is to add an invoice item for the amount you want to charge and set a trial period until you want the renewing charge to occur (so in your example you set a trial_end for the next 1st of month). This will generate an initial invoice with the invoice item and then set your recurring payment as you desire.

Pausing and unpausing a payment collection on stripe

I'm working on stripe subscription and trying to build a flow using which admin can pause and unpause the payment collection of customers.
To achieve this I'm using this from stripe documentations.
Now the major issue which I'm facing with this method is.
Suppose a customer is on monthly subscription and is billed on 1st of every month.
Admin has paused the customer's billing on 15th October and Unpaused it on 15th November.
Now the upcoming invoice shows that customer will be billed on 1st December for the upcoming cycle.
My questions are:
Is there any way I can charge customer for the period of 16th-30th November which customer used.(Somehow adjusting amount on the 1st December invoice)
And the period of 16th-31st October, for which Customer has already paid on 1st October, can be uncharged/adjusted somehow.
Thanks
Instead of pausing, which does not take into account prorated amounts or credits, I recommend canceling the Subscription instead of pausing it. You can use the prorate parameter when canceling Subscriptions to issue a credit to the Customer for the unused time.
Later, when you want to resume payments, create a new Subscription for the Customer and specify a billing_cycle_anchor set to the first of the month. That will charge them for the partial month up front followed by full monthly Invoices starting on the first of every month.

Stripe Start Date

How do you set the start date for a subscription? Many of our customers began using our service a few days before we could collect their payment information so we'd like to charge them for these additional days.
This is not something that the Subscriptions API supports today. You would need to charge your customer the full amount and then put them on a trial period until their next billing date.
The flow would look like this:
Create a Customer with the card token
Create an invoice item for the plan amount
Create a subscription and set them on a trial period until their next billing date using trial_end
The last step will create an invoice for the trial, automatically pull the pending invoice item into the invoice and charge the customer for that amount. Then, they won't be charged until the date you set in trial_end and each month moving forward on that date.

Stripe annual billing but different set of months

I want to bit a customer on an annual basis but the billing should happen between August current year - July of the next year. Can this be done via webhooks or some other method on Stripe ?
You can update the subscription with the trial_end parameter to choose the next billing date (and prorate set to false).
When the "trial" ends, a new billing cycle will start and Stripe will attempt to bill the customer for the plan's amount.
More info about this: https://stripe.com/docs/subscriptions/billing-cycle#api

Stripe - possible for zero quantity subscription

I have a subscription plan on stripe, and use this for per seat pricing.
The specific use case is:
Customer has previously paid and so has customer id and subscription id in the database
They remove all of their users one month
The next month they add a user again
I want the end date to have been updated to the end of the current month when the bill period rolls over, so that I don't display a message saying they didn't pay for previous bill period.
In the stripe subscription object, can I set the quantity for the subscription to 0, meaning the customer won't get billed?
If I do this, will the webhook for invoice.payment_succeeded still be called? This allows me to update information in the database.
Is there a different webhook I should be using for this?
Yes if you will set quantity of subscription to 0 then still a zero dollar invoice still come in payment_succeeded webhook and will update the invoice.

Resources