laravel / cashier-stripe

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

Invoice has invalid id #928

Closed GautierDele closed 4 years ago

GautierDele commented 4 years ago

Description:

Hello, I'm trying to delete the upcoming user invoice in case there is still tabs left in it but i'm encountering the next issue: "Could not determine which URL to request: Stripe\Invoice instance has invalid ID: ". It seems like the invoice item given by laravel/cashier doesn't have an ID. Is it intentional ?

Steps To Reproduce:

$request->user()->upcomingInvoice()->asStripeInvoice()->delete();

Make sure you have pending tabs:

$request->user()->tab('Test tab', 500);

Thanks, Gautier

GautierDele commented 4 years ago

I'm closing this, by checking source code it can't be from laravel/cashier -> seeing with stripe

GautierDele commented 4 years ago

For those who get here with same issue, when you retrieve an invoice from stripe. It's only a preview so there is no id. This is confusing because the doc says it has one https://stripe.com/docs/api/invoices/upcoming. I changed my app logic and made sure the tab function is always followed by an invoice function in order to avoid dangling invoices.