laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.39k stars 680 forks source link

invoice() method of subscription creates empty invoice #1680

Closed bbprojectnet closed 4 months ago

bbprojectnet commented 5 months ago

Cashier Stripe Version

15.2

Laravel Version

11

PHP Version

8.3.7

Database Driver & Version

PostgreSQL 16

Description

As described in the method invoice() of subscription: "Invoice the subscription outside of the regular billing cycle." should generate new invoice in the middle of cycle. Unfortunately, the invoice is for 0.00 despite a different balance on the upcoming invoice.

Maybe I misunderstand the intention of this method, but is there a way to invoice during the cycle and thus reset it?

Steps To Reproduce

  1. Create subscription with metered price.
  2. Add some usage.
  3. Invoke invoice() method of subscription.

Result: empty invoice was created, the user's balance has not changed (it has not been paid).

driesvints commented 4 months ago

Hi @bbprojectnet, sorry I kind of lost track of this one. Could you provide me with a repo to reproduce this?

laravel new bug-report --github="--public"
sundra-maggi commented 4 months ago

I'm having this exact same issue, it looks like metered subscriptions do not get charged for usage when either calling invoice() or swapAndInvoice(). Current workaround is accessing the stripe client directly.

driesvints commented 4 months ago

I need a repo to reproduce this otherwise it's gonna be hard for me to recreate this.

sundra-maggi commented 4 months ago

There is literally nothing fancy here.

Create a Stripe Product with any type of metered billing. Subscribe a user to said subscription product. Add usage to said subscription. Run invoice() or swapAndInvoice() and note how the invoice generated does not include charges for usage.

I'd drop my repo here but it's corporate so I can't. However, if I do find the time to do so I'll throw together a quick example for you.

driesvints commented 4 months ago

Managed to reproduce this but this unfortunately isn't a Cashier issue. We simple implement the way the API's work. There is a reason why this isn't invoicing the metered usage on an existing subscription but I can't find anything in the legacy docs that would hint at what's wrong.

For this, I kindly redirect you to Stripe Support. Please do let me know if you find the exact reason so we might update Cashier with a solution. Thanks