How to give discount on new Stripe subscription? - stripe-payments

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.

Related

Stripe appears to be billing twice for each Subscription

We are using Stripe subscription. In that if a user creates a Product then they can set the price suppose $9.99.
If the other users wants to subscribe the same product they have to pay $9.99. From the paid $9.99, the admin will get 2% and (2.9 + 0.30)% Stripe fee will be deducted and the remaining amount will be sent to the product creator's connect account.
The issue is if the user subscribe a product, a charge is created and the amount deducted from the subscriber. Then the invoice will generate and that time, again the amount will deduct from the subscriber a/c. Double time payment cuts from the subscriber's account.
I'm using destination-charges method to apply the charge and transfer the amount to creator's connect account for any subscription in the invoice.payment_succeeded webhook's method.
How to prevent 2nd time payment deduction?
enter image description here
Creating a subscription will generate an invoice that will charge for the upcoming period(they are charged in advance, so if you had also done a destination charge before creating the subscription, you are charging the customer twice — I assume that's what you mean?
What you probably want to do here is one of :
instead of doing a one-off destination charge or doing a transfer manually from a webhook handler, just set the application fee on the subscription so it's deducted from the invoice instead, by setting the destination of the funds and the application fee you keep :
https://stripe.com/docs/billing/subscriptions/connect#transfer
https://stripe.com/docs/api/subscriptions/create#create_subscription-application_fee_percent
if for some reason that is not an option and you still need to do a separate charge than the first invoice, maybe create the subscription with trial_end set until the next billing date, which will skip the first payment (sine you already processed it)
https://stripe.com/docs/api/subscriptions/create#create_subscription-trial_end

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 - 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.

Stripe Payments Charge

Is it possible to control the charge date in Stripe? For example, we need to charge:
One-time charge ($5) that needs to be charged on the purchase date.
One-time set up fee ($99) that is charged after 30 days from the purchase date.
Recurring charge ($79) that needs to be charged at the end of the term (It can be either Monthly or recurring)
Is that possible to have all these charges in the same subscription? If so how to do it with Stripe APIs?
When you set up a subscription with Stripe, you define price and interval they are charged. There is an option to have a trial period, so that you can have the first charge delayed - but beyond that there are not other options. Note that subscription plan details (price, interval, etc.) are, by design, not editable
In order to implement the business rules you have listed, you will need to implement that yourself. You can do so by:
create a subscription plan with X day trial (I'm not 100% sure if that's what you mean by 'to be charged at the end of the term').
creating the customer and saving a card for that customer.
charge the one-time charge on the purchase date.
start the subscription for the user on the purchase date (or 30 days later, depending on what is meant by 'end of the term').
then charge the 'set up fee' charge 30 days later.
There may be some services (such as Azure's Logic App Service) that could help you implement this business process but you won't be able to do it with just Stripe.

Stripe Cancel one payment in subscription?

Is it possible in a Stripe recurring/subscription to cancel one debit/charge (I.e The customer shouldn't be charged for one month/week/day etc).
Eg: Month 1, Stripe debits customer.
Month 2, Customer has decided service isn't required so we need to avoid debit this month.
Month 3, Stripe debits customer.
I've checked stripe docs and it only seems to mention completely cancelling the subscription, and getting the customer to re-subscribe which isn't very affective.
There are a couple options you could choose to credit the customer:
One would be to create an invoice item with a negative amount. This would apply a credit to the next upcoming invoice.
Another option would be to edit the account_balance of the customer, this would deducted upon the next subscription charge.
https://stripe.com/docs/api#create_invoiceitem
https://stripe.com/docs/api#update_customer

Resources