# Payments API Error

**URL:** <https://developer.squareup.com/forums/t/payments-api-error/18463>\
**Category:** Questions\
**Tags:** payments-api, sandbox, web-payments-sdk\
**Created:** [August 26, 2024, 8:17pm UTC](https://developer.squareup.com/forums/t/payments-api-error/18463 "2024-08-26T20:17:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnStraumann](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@JohnStraumann](https://developer.squareup.com/forums/u/JohnStraumann)\
**Post date:** [August 26, 2024, 8:17pm UTC](https://developer.squareup.com/forums/t/payments-api-error/18463/1 "2024-08-26T20:17:31Z")

</div>

I just set up an account and tried following this video:  
[Sandbox 101: End to End Payments with Web Payments SDK - YouTube](https://www.youtube.com/watch?v=SymdOPCGvq4&t=306s)

but I get an error when I run the page:  
main-iframe.js:3

GET [https://pci-connect.squareupsandbox.com/payments/hydrate?applicationId=](https://pci-connect.squareupsandbox.com/payments/hydrate?applicationId=)&hostname=localhost&locationId=&version=1.60.5 401 (Unauthorized)

square.js:3 Initializing Card failed UnexpectedError: An unexpected error occurred while initializing the payment method.  
at Object. (square.js:3:298322)  
at Generator.throw ()  
at hh (square.js:3:296633)  
at a (square.js:3:296874)

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [August 26, 2024, 8:17pm UTC](https://developer.squareup.com/forums/t/payments-api-error/18463/2 "2024-08-26T20:17:45Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[In-App Payments SDK Quickstart](https://developer.squareup.com/docs/in-app-payments-sdk/quick-start)**
>
> Learn how to set up an application that embeds the Square In-App Payments SDK.

> **[In-App Payments SDK Quickstart](https://developer.squareup.com/docs/in-app-payments-sdk/quick-start/start)**
>
> Learn how to set up an application that embeds the Square In-App Payments SDK.

> **Additional Documentation**
>
> [Square Sandbox](https://developer.squareup.com/docs/devtools/sandbox/overview)  
> [Get Started](https://developer.squareup.com/docs/square-get-started)  
> [Make your First API Call](https://developer.squareup.com/docs/get-started/make-api-request)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [August 26, 2024, 8:26pm UTC](https://developer.squareup.com/forums/t/payments-api-error/18463/3 "2024-08-26T20:26:31Z")

</div>

The error message you’re seeing indicates that there’s an issue with the authorization. This usually happens when the application ID or location ID you’re using is incorrect or not properly configured.

Please ensure that you’re using the correct Sandbox application ID and location ID. These can be found in your Square Developer Dashboard under the Sandbox section.

Also, make sure that you’re using the correct Sandbox URL ([https://connect.squareupsandbox.com](https://connect.squareupsandbox.com)) in your code.

If you’ve checked these and the issue persists, it might be worth double-checking your entire setup process to ensure all steps have been correctly followed.

_This answer was reviewed by @Bryan-Square._

---

<div class="post-metadata">

**Author:** ![JohnStraumann](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@JohnStraumann](https://developer.squareup.com/forums/u/JohnStraumann)\
**Post date:** [August 27, 2024, 11:53am UTC](https://developer.squareup.com/forums/t/payments-api-error/18463/4 "2024-08-27T11:53:16Z")

</div>

I followed the steps exactly, not sure what else I can do? I tried to attach files but got an error, grab screens here:

[Square3.zip](https://1drv.ms/u/s!Au3qGElrrIbJkd8hJszRURsRbc_9Vg?e=Nd7VSL)
