# API Sandbox returning Error: Unable to process your payment, please try again

**URL:** <https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [April 2, 2024, 5:12pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239 "2024-04-02T17:12:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nigelthurlow](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@nigelthurlow](https://developer.squareup.com/forums/u/nigelthurlow)\
**Post date:** [April 2, 2024, 5:12pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/1 "2024-04-02T17:12:00Z")

</div>

I have been using the sandbox for years without issue and today when testing I am getting the error “Error: Unable to process your payment, please try again.”

```auto
define('SQUARECUSTOMER_URL', 'https://connect.squareupsandbox.com/v2/payments');
define('SQUARECUSTOMER_URL', 'https://connect.squareupsandbox.com/v2/customers');
define('SQUAREPAYMENT_JS', 'https://sandbox.web.squarecdn.com/v1/square.js'); 
define('SQUAREPAYMENT_APPID', ‘myappid’);
define('SQUAREPAYMENT_SECRET', ‘my’secretcode);

```

The following is the code that we use. I obviously removed by app id and secret code.

Any help gratefully received.

---

<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:** [April 2, 2024, 5:12pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/2 "2024-04-02T17:12:18Z")

</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:

> **[Square Sandbox](https://developer.squareup.com/docs/devtools/sandbox/overview)**
>
> An overview of the Square Sandbox, which can be used to simulate orders, invoices, payments, and transactions in a test environment.

> **[Sandbox Payments](https://developer.squareup.com/docs/devtools/sandbox/payments)**
>
> A quick reference of test credit card numbers and payment tokens you can use to make test payments with the Square Sandbox.

> **Additional Documentation**
>
> [https://developer.squareup.com/docs/devtools/sandbox/testing](https://developer.squareup.com/docs/devtools/sandbox/testing)  
> [https://developer.squareup.com/docs/in-app-payments-sdk/troubleshooting](https://developer.squareup.com/docs/in-app-payments-sdk/troubleshooting)  
> [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:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 2, 2024, 5:14pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/3 "2024-04-02T17:14:30Z")

</div>

What’s your application ID? 🙂

---

<div class="post-metadata">

**Author:** ![nigelthurlow](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@nigelthurlow](https://developer.squareup.com/forums/u/nigelthurlow)\
**Post date:** [April 2, 2024, 5:19pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/4 "2024-04-02T17:19:06Z")

</div>

sandbox-sq0idb-z-ZAOdtngXehn3lqNrmO6Q

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 2, 2024, 5:31pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/5 "2024-04-02T17:31:59Z")

</div>

Looking at your [API Logs](https://developer.squareup.com/apps/sq0idp-4iDgpGjc0z6XK01V33aFHA/log) I don’t see that the `source_id` or `amount_money.amount` and `amount_money.currency` are set in the call to `CreatePayment`. All I see is that the `idempotency_key` is set.

```auto
{
  "idempotency_key": "1712077404-39077"
}

```

🙂

---

<div class="post-metadata">

**Author:** ![nigelthurlow](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@nigelthurlow](https://developer.squareup.com/forums/u/nigelthurlow)\
**Post date:** [April 2, 2024, 5:34pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/6 "2024-04-02T17:34:06Z")

</div>

I have zero idea how/why, so I will have tp ask our developer to take a look. We have made no code changes, so maybe something behind the scenes that passes those values to you must have change or become out of date. Thanks for checking the why.

---

<div class="post-metadata">

**Author:** ![nigelthurlow](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@nigelthurlow](https://developer.squareup.com/forums/u/nigelthurlow)\
**Post date:** [April 2, 2024, 5:38pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/7 "2024-04-02T17:38:19Z")

</div>

I found it! There was a syntax error in the code that could not be found (Wordpress complaining) so we copied a line of code that got rid of the syntax error (both lines were identical so you knows) and when we copied the line we left SQUARECUSTOMER\_URL when it should have been SQUAREPAYMENT\_URL

The simplest things catch us out doh!

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 2, 2024, 5:41pm UTC](https://developer.squareup.com/forums/t/api-sandbox-returning-error-unable-to-process-your-payment-please-try-again/14239/8 "2024-04-02T17:41:00Z")

</div>

Glad to hear you figure it out. 🙂
