laravel / cashier-stripe

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

Cancel Subscription: Method subscription() should get last subcription but it get first subscription #1701

Closed huydevct closed 2 months ago

huydevct commented 2 months ago

Cashier Stripe Version

15.4.1

Laravel Version

10.48.19

PHP Version

8.1.2

Database Driver & Version

No response

Description

When I call method subscription()->cancel(), it must cancel last subcription but it doesn't work like that, it seem cancel first subscription, I read your code carefully and I realised that your code is querying with orderBy('created_at', 'desc')->first() but it doesn't work with some reasons.

Steps To Reproduce

I call subscription()->cancel() and it cancel first subscription so if I call twice, it throw this error: "No such subscription: """.