Understand now I need to create a customer profile on stripe before I can 'update' the subscription.. hmm any ideas on how to create a subscription w/out having them enter in their cc info the very first time?
Edit for clarify: To put this better, any way to create a stripe customer without a card, on the API side of things, I see you can on Stripe's dashboard.
Solution was to use Stripe's native API interface (not Cashier) to..
No support what so ever in Cashier, hopefully soon.
We had a quite similar issue/need, where we wanted to instantly charge, but also store the user for later, and solved it this way:
public function stripeStoreAndCharge($user, $stripeToken) {
// Needs "use Laravel\Cashier\StripeGateway;"
$stripe = new StripeGateway($user);
// Create a Stripe customer, incl. his card data
$customer = $stripe->createStripeCustomer(
$stripeToken,
['email' => $user->email]
);
// Store Stripe ID, etc. in the database.
$stripe->updateLocalStripeData($customer);
// Finally we can charge the customer, now and later, as we just stored his details.
$user->charge(10000, ['currency' => 'php']);
}
You could probably also just use what the stripe/stripe-php package provides, but this here seemed simpler.
I'm just posting this for reference, because I also had a hard time realizing that this case wasn't covered by Cashier. ;)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community