I’m setting up Square payments for a new sandbox application. My sandbox Application ID, Access Token, and Location ID (Default Test Account) all work correctly when I test CreatePayment through the API Explorer — I get a COMPLETED payment.
However, the exact same Access Token, Location ID, and test source_id (cnon:card-nonce-ok), when sent via a direct server-side API call (Cloudflare Worker calling with Authorization: Bearer ), fail every time with:
- Sometimes: [AUTHENTICATION_ERROR/UNAUTHORIZED] “This request could not be authorized.”
- Sometimes: [INVALID_REQUEST_ERROR/BAD_REQUEST] “Not authorized to take payments with location_id=LNSSGJ6H3YXYB”
I’ve confirmed the token is copied exactly (verified via the Explorer’s own generated code/cURL view), tested from a fresh incognito session, redeployed after each change, and confirmed the Application ID matches across both. Can you check whether this Sandbox application/location has card processing fully enabled, or if there’s an account-level restriction blocking direct API calls?
Application ID: sandbox-sq0idb-dozgAFKnykP7wC39CSEa_g
Location ID: LNSSGJ6H3YXYB