I would like to add STRIPE in my website but I'm noticing that is very difficult to use and there aren't more helps in the web.
My first problem is about "Pass the PaymentIntent’s client secret to the client, so how to pass a php variable in my html form.
Before I should create a PaymentIntent object:
\Stripe\Stripe::setApiKey('sk_test_8cpWr3HupPdvL9QK9cVToa4w009OYgxfNm'); $intent = \Stripe\PaymentIntent::create([ 'amount' => 0.89, 'currency' => 'eur', ]);
API Stripe suggest to pass the PaymentIntent’s client secret to the client in this way:
<?php $intent = # ... Fetch or create the PaymentIntent; ?> ... <input id="cardholder-name" type="text"> <!-- placeholder for Elements --> <div id="card-element"></div> <button id="card-button" data-secret="<?= $intent->client_secret ?>"> Submit Payment </button> ...
This is page of API: https://stripe.com/docs/payments/payment-intents/quickstart#passing-to-client
But how can I pass a php variable in html page ?
And someone can explain me what is this client secret ?
I hope you can help me (sorry for my english but I'm italian). Thanks a lot!