1 year ago

Cashier Battle Continues - No such customer

Posted 1 year ago by kvnkrft

I've been through the Laracast video on Cashier, which is outdated, but some people had mentioned that not that much has changed since then. Anyhow, I'm getting an error when I try to create a subscription -- and I'm starting to think that I need to create a Stripe customer first, and use a customer token instead of the token from the check out. If that is the case, then... but I can't find anyone hinting that this is the case.

Here's my code to create the subscription, I didn't use User, but instead used the Company model for my project:

// https://laravel.com/docs/5.5/billing#stripe-configuration
$company->newSubscription('10 Users', '10-monthly')->create($stripeToken);

And here is the error message I see in the logs:

[2018-01-13 11:28:47] local.ERROR: No such customer: tok_1BjnBkLrP3RyeWsmPmbKc7Dn {"userId":21,"email":"[email protected]","exception":"[object] (Stripe\Error\InvalidRequest(code: 0): No such customer: tok_1BjnBkLrP3RyeWsmPmbKc7Dn at /vendor/stripe/stripe-php/lib/ApiRequestor.php:124)

I also changed the model references in services.php, to use Company instead of User.

'stripe' => [
        'model' => App\Company::class,
        'key' => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),

Please sign in or create an account to participate in this conversation.