Square payments api v2 giving payment process 404 error

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.
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.

:wave: What is the source that you are using? Doesn’t look like the link was included in the post. Looking at the error you are correct the it’s definitely not finding the payment request. I’ll be on the lookout for your response with the source.

This is the link I am using as a source. I got it from Square developer forum.

:wave: Thanks for bringing this to our attention. We found the issue and a fix has been deployed. You can now get the updated example. :slightly_smiling_face:

ok thanks for that please tell where i can get the updated example? on the same link ?

Yes, the same link has been updated.

I am using the updated version of V2 payment but I am getting the same Error The only thing i am doing differently from the source is using “composer install” instead of “composer.phar install”.

hello Bryan-square i am looking for the response
thanks!

I am using the recommended link but its not working can you please share some help full material so i can make my Api working i am looking for your response!

@shaeel1625, Looks like there was an undefined variable. A fix has been merged and it is working as expected now. Thanks again for bringing this to our attention. :slightly_smiling_face:

hello the API was working fine but now its showing me again an error i attaching the screenshot so you can check please provide solution ASAP thanks

i am looking for your response

This is with the most recently updated example? If so would you mind sharing the process-payment.php? Please be sure to redact any access tokens if you have them hard coded.

Yes, you’re right.

hello Bryan, having the same issue here too

sandbox api: “https://sandbox.web.squarecdn.com/v1/square.js

process-payment.php

<?php

require 'square/square-php-sdk/example-autoload.php';

use Square\SquareClient;

use Square\LocationsApi;

use Square\Exceptions\ApiException;

use Square\Http\ApiResponse;

use Square\Models\ListLocationsResponse;

use Square\Models\Money;

use Square\Models\CreatePaymentRequest;

use Square\Models\createPayment;

use Square\Environment;

$data = json_decode(file_get_contents('php://input'), true);

$square_client = new SquareClient([

'accesstToken' => '',

'environment' => Environment::SANDBOX,

]);

$payments_api = $square_client->getPaymentsApi();

$money = new Money();

$money->setAmount(100);

// Set currency to the currency for the location

$money->setCurrency("USD");


$orderId = rand(9000, 1000);

$create_payment_request = new CreatePaymentRequest($data['sourceId'], $orderId, $money);

$response = $payments_api->createPayment($create_payment_request);

if ($response->isSuccess()) {

echo json_encode($response->getResult());

} else {

echo json_encode($response->getErrors());

}

?>

Also I will appreciate if you recommend a documentation that shows how to integrate square up card payment in Laravel.

I am looking forward for the response, thanks

If you remove $orderId from the payment request does it work as expected? It looks like you’re generating a random order_id instead of using the one that we generate when calling CreateOrder. :slightly_smiling_face: