-2

i am trying to integrate square payments php api in my website, i am using this source i have followed all the steps but it gives me an error when i proceed to payment after inputting all the card details, the console shows /process payment 404 not found, like the one shown below enter image description here

the payment process file is already in the folder, only change i made from the source is that i used "composer install" instead of "composer.phar install" because that was not working.

can anyone please help on what should be done?

  • Not really clear what you are asking. The repo you referred to, has a file named `process-payment.php` – is that what you are trying to reach, but you specified the URL without the `.php` suffix? – CBroe Jun 16 '21 at 09:29
  • `process-payment.php` and `process-payment` are different things. What part of your setup should be responsible for mapping the requested URL `process-payment` to the file named `process-payment.php`? – CBroe Jun 16 '21 at 09:37
  • @CBroe yes the process-payment.php is supposed to be called automatically from the cdn, but it says it cannot be found, while it is in the folder – sheharyar anwer Jun 16 '21 at 09:37
  • it says sqaure.js is the file that is giving the error, if you can see the picture. square.js is file included via a cdn https://sandbox.web.squarecdn.com/v1/square.js – sheharyar anwer Jun 16 '21 at 09:39
  • Its process-payment.php not process-payment – Grumpy Jun 16 '21 at 09:40
  • _“it says sqaure.js is the file that is giving the error”_ - that’s where the faulty request _originated_. But this file does not appear to contain `process-payment` anywhere, at least not in plain text form. So it probably takes that URL from some configuration variable, and it looks like you simply specified the _wrong_ URL somewhere. – CBroe Jun 16 '21 at 09:42
  • @Grumpy you can see the error in the picture above, can you please guide me on what i am doing wrong, this happens when i press the payment button – sheharyar anwer Jun 16 '21 at 09:42
  • @CBroe i am fully following the source, it mentions nowhere that there is some other configuration variable that need to be set, and i have searched the files there seems none – sheharyar anwer Jun 16 '21 at 09:47
  • Can you add the source of square.js – Grumpy Jun 16 '21 at 10:05
  • @Grumpy sandbox.web.squarecdn.com/v1/square.js its a cdn – sheharyar anwer Jun 16 '21 at 10:17

2 Answers2

0

Use HTTPS instead of HTTP like https://localhost/square3/php_payment.php

Devil
  • 1
-1

i got a fix to this, there was a fault in the sqaure php api itself, i reached sqaure support, there was a variable that had wrong value on their side, the new and updated code can be found here

Follow the rest of the instructions as documented and it should work fine now.