cartalyst / stripe-laravel

Cartalyst Stripe package integration for Laravel.
BSD 3-Clause "New" or "Revised" License
336 stars 58 forks source link

How to use EphemeralKey #41

Closed webstarlee closed 6 years ago

webstarlee commented 6 years ago

$stripe = Stripe::make('my_security_key');

$customer = $stripe->customers()->create([ 'email' => 'my_email', ]);

$key = $stripe->EphemeralKey()->create(['customer' => $customer['id']]);

return $key;

image

brunogaspar commented 6 years ago

Hello @Webdev55486

You don't need to pass an array to the create() method, just the Stripe Customer Id:

$stripe = Stripe::make('my_security_key');

$customer = $stripe->customers()->create([
    'email' => 'my_email',
]);

$key = $stripe->EphemeralKey()->create($customer['id']);

return $key;

Give it a go.

Thanks!

brunogaspar commented 6 years ago

Closing due to lack of activity. Feel free to reopen if you still have issues or other questions.

sourabhsharmait commented 4 years ago

I used this line but get error

$key = $stripe->EphemeralKey()->create($customer['id']);

er

brunogaspar commented 4 years ago

Should be

$key = $stripe->ephemeralKey()->create($customer['id']);