Testing

Troubleshooting Guide

Look up solutions to common problems.

My API call returns an AUTHENTICATION_ERROR error code.

Cause: Authorization errors are typically caused by typos or accidentally using mismatched credentials.

Solution:

  • Make sure you have replaced placeholders and default values in sample code with valid application credentials.
  • Make sure you have configured your credentials correctly. For example, if you are testing calls in production, make sure you are not using sandbox credentials.
  • Make sure you are using the right credential type. For example, application IDs are used for OAuth API calls but Personal Access Tokens are used in Transaction API calls.
  • If you are using SqPaymentForm to generate a credit card nonce, make sure the credentials you use in your sqpaymentform.js file match the credentials you use for API calls that use that nonce.
  • For REST calls, make sure you have set the Authorization header key to "Bearer" and a valid access token.

Note: Older APIs sometimes refer to the application ID as a client ID (client_id) .

My call returns an EXPECTED_INTEGER error code.

Cause: The EXPECTED_INTEGER error code means Square was expecting information as an integer but it was sent as something else (for example, a string or a float). The most common cause is a Money object with an invalid amount value. Money amount values must be integers and greater than, or equal to, 100 .

Solution:

  • Make sure the Money amount value is specified in in the smallest denomination of the currency you are using. For example, the smallest currency denomination for USD is pennies.
  • Make sure the Money amount value is specified as whole number. Do not use decimal numbers.
  • Make sure the Money amount value is greater than, or equal to, the minimum amount for your currency.

Read more about working with monetary amounts.

The SqPaymentForm iFrame isn't loading

Cause: The hosting site does not have HTTPS enabled or the page is rendering with the payment form in a hidden div.

Solution:

Secure your site with TLS to enable HTTPS calls or serve your website on localhost to test.

We strongly recommend against putting the payment form in a hidden div because it leads to rendering problems. If you must use the payment form in a hidden div, call SqPaymentForm.recalculateSize() when exposing the div to force SqPaymentForm to re-render the iframes.

If you continue to have errors after, try opening your browser's development console to check for errors in the console log.

I did not receive my webhook notification

Cause: Square Webhook notifications typically send within 60 seconds of the event. But some notifications may take up to 30 minutes. If the Square Webhooks service times out or does not receive a response from your webhook listener the notification will drop and the Webhooks server will not resend the notification.

Solution:

  • Wait up to 24 hours.
  • Supplement your webhook listener with regular requests to the list or query endpoints for the associated APIs.

I get a not_found error when calling the Charge endpoint.

Cause: Receiving a not_found error from the Charge endpoint is most commonly caused by one of the following issues:

  • Not using the payments form to obtain a card nonce before calling the Charge endpoint.
  • Calling the Charge endpoint without providing a card nonce in the request.
  • Attempting to charge a card nonce with credentials different from those used to generate the card nonce. For example, attempting to use a live OAuth access token to charge a card_nonce generated with sandbox credentials will result in a not_found error.

Solution:

  • Use only the Square Payment Form to generate card nonces. See the Payment Form Setup Guide for more information.
  • Be sure to charge a card_nonce with the same credentials used to generate it. You can find your application credentials in the Application Dashboard.

Python errors while parsing with ValueError: No JSON object could be decoded

Cause: Your client library does not chunk encode the JSON response. Square API endpoints return responses in a Transfer-Encoding: chunked format. Many libraries, including our Connect SDKs, will handle this automatically for you. However, Python's httplib and JSON libraries will return the raw chunked request body.

Solution:

  • We strongly recommend you install and develop using our Connect SDKs. These SDKs add a helper wrapper that make it easier to integrate with Connect APIs.
  • If you do not use our SDKs, you can verify chunk encoding by checking the response for the Transfer-Encoding header. Alternatively, you can also examine the response body. If it alternates lines of hexadecimal numbers and JSON text, then the response is chunked. Learn more about Transfer-Encoding.
Prev
< Testing in Unsupported Regions
Next
Square SDKs >

Ask for help on Stack Overflow or join our Slack channel