x

Card nonce not found in charge api.

Whenever we are calling the charge API we are getting the error "Card nonce not found in this `sandbox` application environment. Please ensure an application ID belonging to the same environment is used to generate the nonce.". 

Can anyone tell me what should I used as card nonce in the sandbox account.

 

I used the following code:

public function charge()
{
$transcation = Square::charge([
'amount' => 500,
'card_nonce' => '62229[Redacted]0',
'location_id' => 'CBASEO-z9geAh6VET0JNph6vi6xxxx,

'currency' => 'USD'
]);

return response()->json(compact('transcation'));
}

 

997 Views
Message 1 of 2
Report
1 REPLY 1
Admin

Hello @nimapatel, welcome to the Seller Community! 

 

This can happen if you're using mismatched production and sandbox access token and application ids. To fix it, you should make sure that:

  1.   Your `sqpaymentform.js` is using your sandbox application id (if you want to use sandbox).
  2. Wherever you're creating the `Transaction API` and calling the `Charge` endpoint, you need make sure you're using your sandbox access token.

Also remember when you want to change to production, you also need to change in both places as well. 

 

This doc includes where to set the application id for the `sqpaymentform.js`:

https://docs.connect.squareup.com/payments/sqpaymentform/setup#step-5-set-your-application-and-locat...

985 Views
Message 2 of 2
Report