1
votes

I am trying to implement what mentioned here but getting error:

Array ([type] => invalid_request_error [message] => No such customer: 92 [param] => customer)

I am using Laravel Cashier:

$user = User::find($current_user_id);

if ($user->charge(100, [
    'customer' => 92,
    'source'      => $token,
    'description' => "Testing Payment Deduction for Brief"
])
) {
    print "Awesome";
} else {
    print "it failed";
}

Using this code to create customer fails as it trie to create a record in users table which does not need as I already have a user created:

        $customer = $user->create(array(
            'email' => '[email protected]',
            'card'  => $token
        ));

How can I send my existing customer ID and email to Stripe?

1
the customer's id would be $customer->id, where are you getting 92 from? - Matthew Arkin
@MatthewArkin the second snippet which supposes to return id is actually creating a user in users table. I don't need this. - Volatil3
@MatthewArkin I was implementing what mentioned here: stripe.com/docs/checkout/guides/php - Volatil3
Do you want to save the customer in stripe as well to charge them in the future or are you only creating the charge once? - Matthew Arkin
I do not want subscription model but I do want to have customer information saved as my system is pay on go for registered customer - Volatil3

1 Answers

0
votes

This issues erupts only due to one reason and that is token generated by following function.

Stripe.card.createToken($form, stripeResponseHandler)

in stripeResponseHandler(status, response) response.id is the token value. so please use this token to create subscription or whatever... Thanks