Complete payment using cnon as a payment method is getting “Card nonce not found” Error

After creation of cnon payment method using react-native-square-in-app-paymentsV1.7.6, and create delayed payment and then complete payment, it’s using square node SDK in the backend version 37.0.0 and the payment response is getting the following error.

“errors”: [
{
“category”: “INVALID_REQUEST_ERROR”,
“code”: “NOT_FOUND”,
“detail”: “Card nonce not found”
}
]
  • I’ve done some research and some questions regarding to this mentioned that it could be a mismatch environments in the client and the backend, this’s not the case due to
    some payments with cnon payment method are completing ok and it works as expected.
  • Also the creation of the cnon uses Production Application ID - sqOidp-********* and the backend - Production Application- secret- this gets refresh an Auth access token. The access token can be from the main access token or the seller access token, because it’s using different locations attached to merchantId,

Please find the delay payment request

 const response = await squareClient.paymentsApi.createPayment({
      sourceId: paymentNonce,
      orderId:orderId,
      idempotencyKey: uuidv4(),
      amountMoney: {
        amount: BigInt(totalCents),
        currency: 'USD',
      },
      delayDuration: 'PT24H', // 24-hours delay transaction before the delayed payment void by itself
      autocomplete: false,
      customerId: paymentCustomerId,
      locationId:squareLocationId,
    });

and complete payment

const payment = await squareClient.paymentsApi.completePayment(squarePaymentId, {
          versionToken: squareVersionToken,
        });

is there any other reason why it’s getting back with this error?

: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

In-App Payments SDK Quickstart
In-App Payments SDK Quickstart
Cash App Payments

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.

Is the server configured to the same environment that the client configured to? Also did the same application that created the payment the one that is calling CreatePayment? :slightly_smiling_face:

yes it’s, the same configuration and both point to production - sq0idp- connect.squareup.com

Is the access token from that same application? Also please don’t share the access token. They are secret. :slightly_smiling_face:

yes the access token is from one of the merchantId but it could be that we initiate the client with the seller access token or the main access token,
this is how the client configuration

const client = new Client({
  bearerAuthCredentials: {
    accessToken, // access token can be from the main location or the seller 
  },
  environment: Environment.Production 
});

and in the client

import {SQIPCore} from 'react-native-square-in-app-payments';

await SQIPCore.setSquareApplicationId(
             'sq0idp-***'
            );

You’ll want to make sure that credentials aren’t getting mixed up. That’s the only way to get the error your getting. :slightly_smiling_face:

1 Like