stripe-archive/developer-office-hours

Can't create a user with payment method.

pareshinfoleaf opened this issue · 6 comments

I am trying to create the user using Laravel. If I'll creating the user using email only than it's working but not with payment method.

Route::post('/create_customer',function(Request $request){

$stripe = new \Stripe\StripeClient('sk_test_key');
try
{
$customer = $stripe->customers->create([
'email' => $request->email,
'payment_method' => $request->payment_method,
'invoice_settings' => ['default_payment_method' => $request->payment_method],
]);

}
catch ( \Exception $e ) {
print_r($e);

}
return $customer;
})->name('create_customer');

Hey @pareshinfoleaf is the payment method populated there? Which example is this from?

i have watched you example the link is below.
https://www.youtube.com/watch?v=GOp-Pt82Bes

what is the error you get when trying to create with the payment method?

Recently i have tried to create the customer. please find the image for your reference.
screencapture-dashboard-stripe-test-logs-req-qnIfRL51fgMFFX-2020-09-22-11_22_51

It seems that payment method ID might be incorrectly wrapped in a string or something. Since you're using laravel, have you looked at laravel cashier which handles a lot of this for you? https://github.com/laravel/cashier-stripe

Closing for inactivity.