I am using the create payment endpoint to process payments.
It works fine 90% of the time, and returns the payment JSON.
10% of the time it returns the error {“errors”: [{“code”: “NOT_FOUND”,“detail”: “Card nonce not found”,“category”: “INVALID_REQUEST_ERROR”}]}.
I am certain that I am sending the correct payment token, (source_id, card nonce)
returned by Square. i searched my log to make sure I am not re-using an old payment token.
I’ve tried resubmitting the post on failure to try again. I know it’s not the device because I can run 10 transactions on a device and have one fail.
Below is the request info from the API log. The first one failed the second one succeeded.
Thanks in advance for any help.
{
"source_id": "[redacted]",
"idempotency_key": "51991464",
"amount_money": {
"amount": 11500,
"currency": "USD"
},
"autocomplete": true,
"customer_id": "97773",
"accept_partial_authorization": false
}
{
"source_id": "[redacted]",
"idempotency_key": "82876609",
"amount_money": {
"amount": 5500,
"currency": "USD"
},
"autocomplete": true,
"customer_id": "97773",
"accept_partial_authorization": false
}
Is the CreatePayment
request getting sent prior to the token being generated and sent to the backend? If you validate that the source_id
is included before any request is sent does it solve the issue? 
Thanks for responding Bryan. When the source_id is sent I record what was sent. There hasn’t been a case when the source_id was empty. I’m certain that I’m sending the source_id that I got from Square. I’m also sure that I’m not trying to re-use an old source_id. And I don’t have any kind of logic that would randomly create an incorrect source_ID.
Okay, if that’s the case if you retry the request does the payment succeed or do you get the same error? 
Same error. If I knew what source_ID it was expecting it might help. If I’m using the wrong ID I don’t know where it would come from besides Square.
The source_id
is expecting is alway the token that’s returned from the tokenize
request from the Web Payments SDK. It looks like: cnon:CBASEH0FOa3a4tqMMfYfD9i_8t4

Yes, I am getting the source_id from the tokenize request. It is successfully completing the transactions 90% of the time.
The question is why, 10% of the time, is it returning an error saying source_id not found. Where did I get a bad source_id? I don’t have any logic that creates source_ids. I’m not reusing an old source_id, if I re-use one it says it has been used already. I’m getting the error that it can’t find the source_id when I submit the payment. Is there any way to see the source_ids in the API log. Source_ids are redacted in the API log. I don’t know why they are redacted since they are disabled after use.
What’s the application ID and do you have a recent example of this happening? If so could you provide the request? 
Here is my application ID: sq0idp-bVuaxYqK9c94A9rl91eMVA
Here is my API log from today
Request
content-length: 259
content-type: application/json
square-version: 2022-10-19
accept-encoding: deflate, gzip
accept: */*
user-agent: FileMaker/17.0
{
"source_id": "[redacted]",
"idempotency_key": "96305309",
"amount_money": {
"amount": 10000,
"currency": "USD"
},
"autocomplete": true,
"customer_id": "97773",
"accept_partial_authorization": false
}
Response
date: Mon, 05 Dec 2022 12:38:53 GMT
content-length: 105
content-type: application/json
square-version: 2022-10-19
strict-transport-security: max-age=31536000
x-frame-options: DENY
{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "NOT_FOUND",
"detail": "Card nonce not found"
}
]
}