How we can preview prorations in laravel cashier or what is the logic of calculating prorations on any subscription?
Asked Answered
B

2

0

I have created a subscription for any of product using laravel cashier and the subscription is for one month then in id of subscription user wants to sowngrade or upgrade his subscription then how can we calculate unused time on cost on existing subscription in laravel cashier.

I am not using stripe/stripe-php i am using laravel cashier

How we can preview prorations?or What is the logic of calculationg prorations?

Barbaresi answered 6/4, 2021 at 20:51 Comment(0)
F
3

Laravel Cashier uses stripe/stripe-php package so you could use \Stripe\Invoice::upcoming() method.

From Cashier v13 Cashier offers a wrapper for previewing:

$invoice = $user->subscription('default')->previewInvoice('price_yearly');

You can read more about this: https://laravel.com/docs/8.x/billing#previewing-subscription-invoices.

Fornof answered 11/10, 2021 at 18:17 Comment(0)
C
0

While Stripe's API has an upcoming invoice endpoint that supports previewing changes to subscriptions (change prices, quantity, etc), it does not look like Cashier offers this functionality. Or at least nothing that sounds like an implementation of this feature is included in their documentation. You could contact them to ask about current/future support for this feature.

You can read all about Stripe's proration logic here in the docs.

Continuation answered 6/4, 2021 at 21:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.