Prorating/refunding the cost of a previous stripe plan when creating a new plan and subscribing user to it - stripe-payments

I basically want to know whether Stripe is automaticall refunding customers a prorated amount.
My process for updating a customer to a new plan:
Delete the old plan.
Create the new plan.
Create the new subscription.
Update user to new subscription.

If you create a new subscription then cancel the old one, the customer will be billed for the new subscription but will not gain any credit or refund for the unused time on the old subscription.
If you update the existing subscription to switch from the old plan to the new one, then by default Stripe will compute the proration (you can disable this by setting prorate to false in the subscription update request).
If the proration ends in favor of the customer, they will be granted credit in the form of a negative account balance. Customers' account balances are applied to future invoices before trying to actually charge the customer. Stripe will not partially or totally refund any past charges.
You can read more about subscription updates and proration in this paragraph of the subscription integration guide.

Related

Is it possible to alter a recurring price that an existing customer is charged with Stripe API?

If an Express Connect Account holder creates a Product with a Recurring Price of say $10/month. And a customer signs up for this, a Subscription is created and Stripe will automatically bill the customer $10/month until they cancel. So here is my question...if the Connect Account holder wants to increase their Price from $10/month to say $12/month...can they do this such that the price increase will be billed to existing customers as well as new customers? I am thinking of an example where the Connected Account has say 100 existing subscribers, so manually changing each one, doesn't really work. Looking for something automated. From what I have read, it seems, that only new customers will see the new $12/month Price, and existing customers will see the original $10/month price until they cancel. Is this correct? Seems odd that Stripe would have no way of allowing Connect Account holders a way to increase their recurring Prices for existing users. I get they can create a new price..and hope users voluntarily switch to the new high price, but that seems odd.
You would want to think Subscription as per-customer object. Let's say you have 100 existing Customers already subscribed to a $10 monthly plan, there are 100 existing Subscriptions object, tights to each of those Customers.
Now if the Connected Account created a new price of $12/month, all new Customers will subscribe to this new price, and create separated new Subscription objects.
If you want to upgrade the currently existing Subscriptions, you would need to update each of them, changing the old price to the new price, by Stripe's Subscription Update API. Make sure to read the note about Proration, or refer to Proration Doc

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 - after changing plan, don't bill for the new subscription until current cycle ends

I want to let user to change their subscription plan. However, they won't be refunded after switching. If i set the prorate to false, stripe will bill for the new subscription right away.
For example, if the user is subscribed to a yearly plan in Jun 2018, and wants to change to monthly in Oct 2018. They will be charged with monthly plan after Jun2019, as current cycle hasn't ended yet.
How can I do with stripe api when i am updating the current subscription?
in the stripe api docs (https://stripe.com/docs/api/subscriptions/update)
"if you set prorate to false when switching between different billing intervals (monthly to yearly, for example), we won't generate any credits for the old subscription's unused time—although we will still reset the billing date and will bill immediately for the new subscription."
In 2019 Stripe shipped support for Subscription Schedules which allow you to control multiple sequential phases on a Subscription. You can read more about this in the docs: https://stripe.com/docs/billing/subscriptions/subscription-schedules
With this API, you can now explicitly schedule a future change of a Subscription. The idea would be to use the Create SubscriptionSchedule API a schedule from your Subscription and plan a second phase to move the Subscription to the new price on the next billing cycle.
Past answer, which still work but less optimized:
One solution for this would be to follow those steps:
Mark the current subscription to cancel at the end of the current period so that you don't attempt to charge that customer again.
Create a new subscription to the monthly plan but put the customer on a trial period until the end of the current subscription (June 2019 in your example). This allows you to not charge him until the other subscription ends so that you switch the customer to the monthly plan as expected.

can i create a sku object into a service type product?

suppose i have a membership service which cost $10/month in a subscription way
but some users can not have a reusable source to make a subscription via plan api ,alternatively i will let him to do an one-time payment via order api.(at least accept one month's money)
it is the same product,same amount,difference is one is for plan,another is for order,so question is, should i create two products one is goods type(for order),one is service(for plan/subscription). or one service type product is enough?
As a concept in the Stripe Dashboard, product SKUs are only used for recurring plans or invoicing. Any one time purchase can just be a charge, and does not need to be associated with any "Product" within your Stripe configuration.
If the product in this case is literally just one month of the plan, then you should probably use the same Product you have specified.
If the payment method will only work once, you could do nothing, and when the first period is up, and Stripe tries to renew, the payment will fail and the subscription will be canceled.
Or, if you're positive beforehand that it should only be charged once, you could cancel the subscription right after the first payment is completed. The customer would still have an active subscription for the period they paid for, but Stripe would not try to charge them automatically when that first period expired.

How to upgrade plan in stripe?

How to upgrade plan in Stripe for a customer already having a plan, but suddenly wanting to upgrade to a new plan?
Stripe::setApiKey(Yii::app()->params['secret_key']);
$cus = Stripe_Customer::retrieve("cus_7SR4oHy8NwS1DE");
$subscription = $cus->subscriptions->retrieve("sub_7SR4kA30QUQTE9");
$subscription->plan = sliver;
$subscription->save();
With the code above,
when a customer already has a silver plan subscription it's working fine, but when I change to the gold plan it shows the error below.
Can't combine currencies on a single customer. This customer has had a subscription, coupon, or invoice item with currency usd
When users upgrade plan, can I update subscriptions_current_period_end and subscriptions_current_period_start?
Unfortunately, once a subscription or an invoice is created for a customer, they are "locked" into that currency. It isn't possible to create a new subscription or update an existing subscription to switch to a plan in a different currency for that customer.
The only easy solution here would be to ask your customer for his card details again and create a new customer object so that you can subscribe them to a plan in a different currency.
There are other options involving Connect platform, but they may require additional elaborate effort.

Resources