# Stripe implementaion in CakePHP3

**URL:** <https://discourse.cakephp.org/t/stripe-implementaion-in-cakephp3/8447>\
**Category:** Need Help\
**Created:** [October 2, 2020, 2:59am UTC](https://discourse.cakephp.org/t/stripe-implementaion-in-cakephp3/8447 "2020-10-02T02:59:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmcd](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@mmcd](https://discourse.cakephp.org/u/mmcd)\
**Post date:** [October 2, 2020, 2:59am UTC](https://discourse.cakephp.org/t/stripe-implementaion-in-cakephp3/8447/1 "2020-10-02T02:59:22Z")

</div>

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.

Thanks

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [October 2, 2020, 3:48am UTC](https://discourse.cakephp.org/t/stripe-implementaion-in-cakephp3/8447/2 "2020-10-02T03:48:58Z")

</div>

I just recently did an implementation of [Stripe in CakePHP3](https://github.com/Zuluru/Zuluru3/tree/feature/stripe-payments/plugins/StripePayment/src).

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.

---

<div class="post-metadata">

**Author:** ![debendra986](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@debendra986](https://discourse.cakephp.org/u/debendra986)\
**Post date:** [October 2, 2020, 4:55am UTC](https://discourse.cakephp.org/t/stripe-implementaion-in-cakephp3/8447/3 "2020-10-02T04:55:42Z")

</div>

Check this “[https://github.com/stripe/stripe-php](https://github.com/stripe/stripe-php)”

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.
