I have a simple payment form and card processing app that has benn working well for the last nine months. Suddenly on 8/13/21 the card processing script started to fail.
i’m bumping this again because i have no idea how to debug it. my sandbox application ID is sandbox-sq0idb-HVgYltGd6znV_k9X2SGIkQ
and production is
sq0idp-ckhLFgBGyO0jsNpIQqFDrw
Hi @bsack, I took a look at the logs and see that you successfully created a source_id recently however there are no calls to CreatePayment can you confirm that you are getting the source_id? Also is there any more detail in the error message?
Okay, would you mind providing what you are using for the payment request? Also the source_id is the token that our client side form generates to pass to the payment request. I see in the logs that it is being generated however not used to process the payment.
for whatever it’s worth, i checked with our webhosting service (ASO) and there have been no chaanges to firewalls or anything that would block a request or response.
The payment request looks good however I’m not seeing any requests to Square to either get the nonce or CreatePayment. It looks like all the request are failing to reach Square. Is your application able to call any other of our APIs?
Yes, that’s what it seems like. They aren’t even making it to Square. All your requests look good. If you try to run this using localhost are you able to get a successful response? If so this would mean that your hosting server calls aren’t making it to Square.
when i try to run that locations.php from a local server i fail on this error:
127.0.0.1:46642 [200]: /location.php - Uncaught InvalidArgumentException: JsonMapper::mapClass() requires first argument to be an object, string given. in /home/bsack/hw_web/square-php-sdk/apimatic/jsonmapper/src/JsonMapper.php:312
Stack trace:
#0 /home/bsack/hw_web/square-php-sdk/src/Apis/LocationsApi.php(84): apimatic\jsonmapper\JsonMapper->mapClass('{"locations":[{...', 'Square\\Models\\L...')
#1 /home/bsack/hw_web/square/location.php(28): Square\Apis\LocationsApi->listLocations()
#2 {main}
thrown in /home/bsack/hw_web/square-php-sdk/apimatic/jsonmapper/src/JsonMapper.php on line 312
today i was able to run the locations script from localhost, so that seems to point to a problem with the webserver. my webhosting company, A Small Orange, are not being helpful. they’ve suggested that it has something to do with their mod_security rules, but they only provided me with some logs showing blocked incoming requests from crawlerbots and brute force wordpress login attempts.
so i guess we have to find an alternative method of processing credit card payments or get a new hosting service. do you think the Web Payments SDK would have the same problem? i tried the example application on localhost and it successfully sent a payment to the sandbox …
the provider is using TLS 1.2
they’re saying the squareup ip address is not blocked.
also that the secure cURL connection is also working
this is the quote from the support ticket:
This means that the communication from the server to the API might be blocked may be from the internal firewalls. These API connection issues purely depend on how and what is the impact of these connections from single or multiple IPs at the same instance of time. These are the temporary blocks related to many API connections from the server level.
II. Few other reasons:
-Firewall or security modules (example: mod_security ) that could block the outgoing cURL requests.
-It could sometimes be a conflict of plugins and themes or modules on the site.
after having said that there are no firewalls blocking cURL requests? i don’t understand …
off-topic - is there a place in the documentation anywhere that explicity explains how to use the Web Payments SDK on a server as opposed to running the example on a local computer? Are we supposed to upload the entire node.js server and run that on our servers? It’s not clear …
Request that are using TLS 1.2 are valid requests that we accept. I sounds like they were describing rate limiting in their message. If this was rate limiting from too many requests from your server you would have gotten a 429 RATE_LIMIT error. In all honesty I’m not sure what could be blocking the requests.
When you are done testing locally you can follow our guide on deploying the application. You will need to deploy the entire application to your server.
still banging my head against the wall here. One strange thing i just noticed is that if i try to call the location.php script on a different network (my neighbor’s wifi, cellular data, etc), or even with a different browser on the same network, that the request and response will work ONCE, with subsequent requests going back to the familiar timeout behavior.
I will have to wait until i get a new hosting service to try the Web Payments SDK, since i can’t run node.js on my current shared hosting. soon …
That is so frustrating that you aren’t able to make calls with your existing provider. We do have Web Payments SDK examples in other languages available on our connect-api-examples in Git Hub.