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

Cashier still creates a subscription when there's no even a (default) payment method #1583

Closed handhikadj closed 11 months ago

handhikadj commented 11 months ago

Cashier Stripe Version

14.12.8

Laravel Version

10.22.0

PHP Version

8.1.4

Database Driver & Version

MySQL 8

Description

when there's no payment method (card), laravel cashier should throw an exception instead of creating it away. in real life, the subscription should not be created. currently I use test account. if this is expected behavior, then please clarify why

$user
                ->newSubscription('default', config('services.stripe.default_price'))
                ->quantity(1)
                ->create();

screenshot from my stripe (test) account on customer detail:

image

Steps To Reproduce

create new fresh stripe (test) account, code this inside a controller's method and "visit" it:

$user
                ->newSubscription('default', config('services.stripe.default_price'))
                ->quantity(1)
                ->create();
driesvints commented 11 months ago

Hi there. This is the default stripe behavior or creating a subscription and afterwards setting up a payment method.