I’m trying to implement the latest version of stripe payment in a CakePHP project. I’m beginning in CakePHP.
I read the doc but the thing is that, I have to combine JavaScript and CakePHP controller.
My question is how to fetch client_secret in a Javacript function to make it look like stripe doc authorize.
My PaymentIntent is made inside my controller and it should return a secret Key. And that secret key should be use inside a JS function according to stripe Doc. How am I suppose to send or fetch that secret Key inside my JS function.
Note that it’s a plugin, but not a generic re-usable plugin that you can drop into your own code, as it’s very much intertwined with my own data structure. But maybe it’ll help with structuring your own code.
1st Using composer download stripe file “composer require stripe/stripe-php”
2nd Put that download file inside your cakephp3 vendor folder
ADD “require_once(ROOT . DS . ‘vendor’ . DS . “stripe-php” . DS . “init.php”);” in your controller to access stripe
Then use your stripe publishable_key in javascript and in controller use secret_key and publishable_key and follow stripe process. Once payment success you will get transaction id from strip.