question

girish avatar image
girish asked girish commented

An invalid device serial number [deviceId] or token was provided

We encountered the below issue.

we provided the token and the serial number is also correct.

Please let us know why we receive this error on production. (everything works in sandbox with a test merchant)


The OAuth 2.0 token generated below OAuth flow :

Auth flow: https://www.clover.com//authorize

Token: https://api.clover.com/oauth/v2/token


Request :

var options = new RestClientOptions("")

{

MaxTimeout = -1,

};

var client = new RestClient(options);

var request = new RestRequest("https://api.clover.com/connect/v1/device/ping", Method.Get);

request.AddHeader("X-Clover-Device-Id", "{deviceId}");

request.AddHeader("X-POS-Id", "Crown Workflow");

request.AddHeader("Authorization", "Bearer 0b4893c2-e746-02d9-d24d-d8e664f1d83e");

RestResponse response = await client.ExecuteAsync(request);

Console.WriteLine(response.Content);


Response :

{

"message": "An invalid device serial number [deviceId] or token was provided.",

"requestId": "66caf75c-1405190",

"requestType": "PING_DEVICE_GET",

"type": "BAD_REQUEST"

}

Clover Minisemi-integrationsProduction
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

diana658h avatar image
diana658h answered girish commented

Hello, @ FloridaBlue


It seems you’re encountering a BAD_REQUEST error with the Clover API in the production environment, which indicates that either the device serial number or the token provided is invalid. Here are a few steps you can take to troubleshoot this issue:

Verify the Device Serial Number: Ensure that the device serial number is correct and is being passed correctly in the X-Clover-Device-Id header. It should match the serial number of the device registered in your Clover merchant account.

Check the OAuth Token: Make sure that the OAuth token is valid and has not expired. Tokens generated in the sandbox environment will not work in production. You need to generate a new token specifically for the production environment using the production URL for the OAuth flow.

App Permissions: Confirm that your app has the necessary permissions granted by the merchant. Without the correct permissions, the API call will not be authorized.

Environment Consistency: Verify that you are not using sandbox credentials in the production environment or vice versa. This can lead to a 401 Unauthorized error.

Token and Serial Number Format: Double-check the format of the token and the serial number in the headers. They should be passed in the correct format without any additional characters or spaces.

API Endpoint: Ensure that the API endpoint you are using is correct and is available for the production environment.



Best Regard,
diana658h

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

girish avatar image girish commented ·

I have verified that the serial number is correct and the generated token is also correct.

However, my production app has been submitted for approval, but it's still under review and showing as pending. Could that be the reason for getting this error?

0 Likes 0 ·
girish avatar image
girish answered

I have verified that the serial number is correct and the generated token is also correct.

However, my production app has been submitted for approval, but it's still under review and showing as pending. Could that be the reason for getting this error?

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community