# Sandbox CreatePayment fails with "Not authorized" despite valid credentials

**URL:** <https://developer.squareup.com/forums/t/sandbox-createpayment-fails-with-not-authorized-despite-valid-credentials/27947>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [September 22, 2026, 11:43pm UTC](https://developer.squareup.com/forums/t/sandbox-createpayment-fails-with-not-authorized-despite-valid-credentials/27947 "2026-09-22T23:43:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeataAdamczyk](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@BeataAdamczyk](https://developer.squareup.com/forums/u/BeataAdamczyk)\
**Post date:** [September 22, 2026, 11:43pm UTC](https://developer.squareup.com/forums/t/sandbox-createpayment-fails-with-not-authorized-despite-valid-credentials/27947/1 "2026-09-22T23:43:55Z")

</div>

_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_

---

<div class="post-metadata">

**Author:** ![jseok](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jseok](https://developer.squareup.com/forums/u/jseok)\
**Post date:** [September 23, 2026, 2:10pm UTC](https://developer.squareup.com/forums/t/sandbox-createpayment-fails-with-not-authorized-despite-valid-credentials/27947/3 "2026-09-23T14:10:13Z")

</div>

@BeataAdamczyk - There is no enablement required for card processing. Make sure to switch ALL of the following when switching from sandbox to production:

- Base URL (`https://connect.squareupsandbox.com/v2/payments` vs `https://connect.squareup.com/…` )
- Application ID
- Location ID

The errors you are receiving (_Not authorized to take payments…_) is coming from using the sandbox Location ID for calls to your production environment.

---

<div class="post-metadata">

**Author:** ![BeataAdamczyk](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@BeataAdamczyk](https://developer.squareup.com/forums/u/BeataAdamczyk)\
**Post date:** [September 24, 2026, 4:29pm UTC](https://developer.squareup.com/forums/t/sandbox-createpayment-fails-with-not-authorized-despite-valid-credentials/27947/4 "2026-09-24T16:29:17Z")

</div>

Thank you so much for your help.  
Beata
