- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Resource Not Found while trying to process a simple payment using Square Connect API
Hi guys, I'm testing out the Square Connect API in the Sandbox environment and getting the following results below.
I'm using my Sandbox Application ID and Sandbox Access Token. What is the reason that I'd be getting a "Resource Not Found" error message. I'm using a location that does have Credit Card processing enabled. I'm just using the basic example code found here --> https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/php_payment
Caught exception!
Response body:
object(stdClass)#6 (1) { ["errors"]=> array(1) { [0]=> object(stdClass)#7 (4) { ["category"]=> string(21) "INVALID_REQUEST_ERROR" ["code"]=> string(9) "NOT_FOUND" ["detail"]=> string(19) "Resource not found." ["field"]=> string(10) "card_nonce" } } }
Response headers:
array(12) { [0]=> string(22) "HTTP/1.1 404 Not Found" ["Content-Type"]=> string(16) "application/json" ["Vary"]=> string(15) "Accept-Encoding" ["X-Content-Type-Options"]=> string(7) "nosniff" ["X-Download-Options"]=> string(6) "noopen" ["X-Frame-Options"]=> string(10) "SAMEORIGIN" ["X-Permitted-Cross-Domain-Policies"]=> string(4) "none" ["X-Xss-Protection"]=> string(13) "1; mode=block" ["Date"]=> string(29) "Fri, 24 Jun 2016 03:45:38 GMT" ["Content-Length"]=> string(3) "121" ["Keep-Alive"]=> string(10) "timeout=60" ["Strict-Transport-Security"]=> string(17) "max-age=631152000" }
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Sorry to hear about the trouble. I'm going to loop in our developer team on this and we'll get back to you shortly.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Thanks for your patience, just heard back!
So the 404 not found error you are receiving is on the field for card nonce. That means you're trying to charge without one. You need to use the payment form to create a card nonce (https://docs.connect.squareup.com/articles/adding-payment-form/) that you can then use to call the charge endpoint.
Alternately, you could use the customers endpoints (https://docs.connect.squareup.com/articles/saving-customer-information/) to perform card on file transactions.
Hope that helps, let me know if you have additional questions @nmcwilli.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@Spenser I'm having the same issue. I have the request JSON and the card_nonce field is present and populated. Could you help me any further?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Thanks for the heads up, @zhlavinka. I'll report back when I have an update!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@Spenser Thanks! I must have setup that username with one of my clients on accident. I figured out the issue though.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@zhlavinka, it looks like you obtained the card-nonce using your sandbox access token, and then tried to charge the sandbox nonce in your non-sandbox (production) application. The sandbox nonces will only work for the charge endpoint in the sandbox, and production application nonces only work in production.
Hope that info helps!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I'm having the same issue. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Let me know if you need the code.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@Spenser Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Sorry I missed your previous replies, thanks for tagging me @txtumble! I'll report back shortly.

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Alright, @txtumble, sorry for the delay!
Receiving a not_found error from the charge endpoint is most commonly caused by one of two issues:
1) Not using the payments form to obtain a card_nonce before calling the charge endpoint. Documentation for setting up the payment form can be found at https://docs.connect.squareup.com/articles/adding-payment-form/
2) Either obtaining a card_nonce using your sandbox credentials and attempting to charge that nonce with your oauth credentials, or obtaining a card_nonce using your oauth credentials and attempting to charge it with your sandbox sandbox credentials. Please check to make sure that the credentials used to obtain the card_nonce are the same as the credentials used to charge. Sandbox credentials are identifiable by starting with the string "sandbox-". You can find documentation on using the sandbox here and your application credentials at https://connect.squareup.com/apps.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I've used this exact form https://docs.connect.squareup.com/articles/adding-payment-form/ I also know that I'm not using the sandbox because I have several charges that have go through correctly. What would happen if the user had javascript turned off? Could that cause an issue?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
You might actually be using sandbox mode still, @txtumble. You can confirm that you are not in sandbox mode by opening up the browser console (command-option-i in Chrome). If you are in sandbox mode, there will be a short message that starts out "SqPaymentForm initialized in Sandbox Mode...".
That form requires that you replace the application ID (it's marked in a comment in the code: "// <-- Add your application ID here"). Can you confirm that you've added the application ID?
Would you mind sending the specific error that you're receiving? The response body and response headers would be very helpful.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Active URL: https://txtumbleweed100.com/register_online.php?rid=21
Failed response:
( [errors] => Array ( [0] => stdClass Object ( [category] => INVALID_REQUEST_ERROR [code] => NOT_FOUND [detail] => Resource not found. [field] => card_nonce ) ) )
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Thanks! The issue is likely on the server side. Can you see if the code that is making the request is from your server to ours.
Additionally, make sure:
- You're including the card nonce that is generated from the frontend in the request you're making to our servers, using the same applicationId in the frontend and the server side.
- The frontend is using the id "sq0idp-SU7J4NyFb_Gu5z-C70OS4w". The server needs to use that same id when it tries to charge the card.
Keep me updated!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
My experience with this error is with clients using FireFox. Transactions work in all other browsers.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@Spenser did you see this? I've disallowed Firefox. Any idea on when this will be fixed?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Thanks for the mention, @txtumble, and for the heads up @digitalcreation!
It sounds like you need to have an event argument to the submitButtonClick() function when you setup the form. Chrome has a global event, whereas firefox does not. You should be able see the difference between your code (missing event argument) and our example code here: https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/php_payment/index.htm...
This should fix the issue in firefox, but let me know if you're still having any trouble.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I'm having the same problem, and have verified all the items mentioned in previous posts. Just can't figure out what is causing the problem.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report

- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
@TMBWT, bummer!
Can you share some of your code, or an example of your requests? Is it the exact same error message?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report