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

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.”

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.

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

Additional Documentation

https://developer.squareup.com/docs/devtools/sandbox/testing
https://developer.squareup.com/docs/in-app-payments-sdk/troubleshooting
Make your First API Call

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.

What’s your application ID? :slightly_smiling_face:

sandbox-sq0idb-z-ZAOdtngXehn3lqNrmO6Q

Looking at your API Logs 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.

{
  "idempotency_key": "1712077404-39077"
}

:slightly_smiling_face:

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.

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!

Glad to hear you figure it out. :slightly_smiling_face: