404 request URL not found error comes

i have use php SDK to integrate payment method at over website. but there show me a error 404 after payment procedure complete. there show 404.

Hey @aspak_hala, welcome to the forums! Did you get this error when making a request to the the CreatePayment endpoint? Were there any other details returned in the error?

Hello @josh-square, Thank you for replying, i use SDK package for payment. when I do payment on simple on folder and file (PHP) who have payment code. that time its work proper but in card payment. other payment also not work. but when I use that same code in my project folder that time they show me error 404 request URL not found.

In my code i think problem starts with autoload.php,
my code does not go payment.php page.
but when I put all code in simple on a directory and use local host then API work properly.
but in my project(cloudfunnel - like WordPress CMS) their payment.php file is not found by code.
the URL is - ‘https://aspak.jeetforlife.in/index.php?page=do_payment’.
In this ?page=do_payment is not recognize by autoload.php

I think that’s may be possible. i track all code flow then finally after 6 days I found where the flow broke. when flow comes to payment.php file that time pament.php file not found by code.

$prefixToLocation = [
“Square\” => “/src/”,
“apimatic\jsonmapper\” => “/jsonmapper/src/”,
// This is the Namespace and location from Apimatic/Unirest’s composer.json
“Unirest\” => “/unirest-php/src/Unirest/”,

I’m not sure I’m 100% following here, sorry! Is your project using payments.php for your backend logic, and you’re having difficulty passing data to it from your front end? Or is payments.php not a file in your project at all?

If you’re following one of Square’s quickstart guides for this, could let me know which one and on which step you’re getting stuck? That may help me get a better idea of what’s going on. Thanks! :slight_smile:

Hello Sir,
I found where is problem.
const paymentResponse = await fetch(‘payments.php’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
in this code paymets.php file not found.
when I use full URL of the payments.php then its work properly.

and when i use that SDK in live payments that time need to change .

because in this sandbox.web is written. can i use this url to live payment?

When I pay with AfterPay then “Amount on the request does not match the checkout amount.” error shows. afterpay pay in an installment payment. what is the solution to this problem?

With Afterpay you’ll still need to pass in the full amount of the order total. It Afterpay that will collect the partial amounts from the customer. :slightly_smiling_face:

Yes Sir, i Already entered amount and final amount both in after pay. but when Payments.php page call there also added a total amount. both amount are same but also response return this error. i don’t no what to do now.

What’s your application ID? :slightly_smiling_face:

My application ID - sandbox-sq0idb-UxrSNPPURfgrxiMDOvk2XA

Google pay , card pay, caseapp pay all work proper but in after pay there API call successfully with status 200. but when i go at API log there show me - ''Amount on the request does not match the checkout amount.",

In payments.php file i entered same amount as entered in afterpay amount. but i don’t no why API through this error.

When Afterpay is initialized what’s the amount that you’re passing in? Is it the same amount that you’re passing into the CreatePayment call? :slightly_smiling_face:

Amount i store in session and both place Afterpay and createPayment pass
that session.

at both place I pass same amount.

The only way I’ve been able to replicate this error is if the amount that I’m charging is different then the total that was used when buildPaymentRequest is called. What’s the amount that you’re trying to charge? :slightly_smiling_face:

function buildPaymentRequest(payments) {
const amount = document.getElementById(‘amount’).value;
const currency = document.getElementById(‘currency’).value;
const req = payments.paymentRequest({
countryCode: ‘US’,
currencyCode: currency,
total: {
amount: amount,
label: ‘Total’,
requestShippingContact: true,

    req.addEventListener('afterpay_shippingaddresschanged', function() {
        return {
            shippingOptions: [{
                amount: '0.00',
                id: 'shipping-option-1',
                label: 'Free',
                taxLineItems: [{
                    amount: '0.00',
                    label: 'Tax',
                }, ],
                total: {
                    amount: amount,
                    label: 'total',
            }, ],

and in payment.php i use this amount by using session.

can this error occur with data type?
Like in payment.php amount is a string and in buildPaymentRequest amount is an integer. Does that make a problem?