I use Laravel Cashier with Stripe to manage my subscriptions. The user will provide information about his credit card at registration, but at the moment they will not be signed in a specific plan. Therefore, I can successfully use Stripe Checkout to create a Stripe client object and store the Stripe client ID in my database. But when the time comes for the user to enter the plan, I see no way to use the Stripe client ID to register them in the desired plan.
Of course, I can again request credit card information and get a Stripe token for use with Laravel Cashier, but I would like to avoid this, because the application already created a Stripe client object when they signed up, d just try to use an existing client object to charge your credit card, and not ask for your card number again.
To illustrate what I'm trying to do, here is a sample code from Laravel docs:
$user->newSubscription('main', 'monthly')->create($creditCardToken);
But what I would like to do is something like this (note the change to the create method:
$user->newSubscription('main', 'monthly')->create($user->stripe_id);
Any tips?
source
share