How to display a customer name in stripe account?

1.7k Views Asked by At

I would like to display a customer name. So I can understand who made a payment in stripe dashboard. I am using laravel. I tried with billing_details but I am getting error that it is unknown parameter. I don't want to create customer object but just wanted display a customer name. Currently, it is displaying None.

I went through stripe api documentation and got to know that we can pass a details using billing_details. But getting error that it is unknown parameter.

$abc = ['name'=> $fname, 'email'=>$email];
$charge = $stripe->charges()->create([
                        'card' => $token['id'],
                        'currency' => 'NZD',
                        'amount' => $price,
                        'description' => 'Strings Workshop Payment by '.$fname.' '.$lname,
                        'billing_details' => json_encode($abc),
                    ]);

1

There are 1 best solutions below

0
On

You need to create customer first. You can check this documentation:

https://stripe.com/docs/api/customers

You get customer id and you can pass this customer id to charge. This customer is reusable. You can retrieve customer details using customer id.