Hi i have seen the code for stripe payment as below. First create a customer object
$customer = \Stripe\Customer::create(array(
"card" => $token,
"description" => "Product Purchase for Book",
"email" => "[email protected]"
));
Then charge by using that customer object
\Stripe\Charge::create(array(
"amount" => $amount, # amount in cents, again
"currency" => 'usd',
"customer" => $customer->id)
);
But below is the code which can be used to charge the user directly without creating any customer object.
\Stripe\Charge::create(array(
"amount" => 3000,
"currency" => "eur",
"card" => $_POST['stripeToken'],
"description" => $_POST['email'],
"metadata" => array("order_id" => "6735", "userid" => '1111')
));
So can you please explain me below things
- Which one is better?
- What is the benefit of creating a customer object?
- Can use store and use that customer object to charge that user any any time say recurring payment?
Thanks in advance