I keep running into "merchant is not authorized for device ID" when attempting to call the terminal checkout API

Status code 400
{“errors”: [{“code”: “BAD_REQUEST”,“detail”: “Merchant not authorized for device_id=device:id”,“category”: “INVALID_REQUEST_ERROR”}]}

Hi, I keep running into the error above, even after generating a device code, and calling the checkout API with the same access token. Anyone else run into this commonly?

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

Handling Errors
Troubleshoot the Payments API
Handling Errors

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.

This error typically occurs when the device_id you’re using in your request doesn’t match any of the device codes associated with your merchant account. Make sure that the device_id you’re using is the same as the one you generated for your device. Also, ensure that you’re using the correct access token that corresponds to the merchant account associated with the device. If the problem persists, you might want to try generating a new device code and ensure that it’s correctly associated with your merchant account.

This answer was reviewed by @Bryan-Square.

Was the device correctly paired prior to creating the checkout? :slight_smile:

Hi Bryan, thanks for the response. Yes I believe it was.

1st I ran the create device code API call, and used the resulting code to sign into the terminal.
Then I ran the /v2/terminals/checkouts to initiate a checkout, and that’s when I get the error. I am working with the same prod access token for all the calls.

What did you pass in as the device_id? Was it the value you got after it was successfully paired? :slight_smile:

I pass in “device:xyz” after it was successfully paired yes.

I also tried this in the api explorer where I just used the dropdown to select the correct device, and got the same error.

I do see the device listed when I run /v2/devices?location_id…

If it shows up here I should be able to send a checkout to it right?

No, the device_id isn’t in that endpoint. If you ListDeviceCodes it will have the code you’ll pass in CreateTerminalCheckout. For example here’s on from my account:

{
            "id": "GCD5B7H6ZPTKR",
            "name": "Counter 2",
            "code": "DBQPCC",
            "device_id": "952CS108A6002588",
            "product_type": "TERMINAL_API",
            "location_id": "3Z4V4WHQK64X9",
            "created_at": "2024-12-12T17:49:24.000Z",
            "status": "PAIRED",
            "status_changed_at": "2024-12-12T17:49:43.000Z",
            "paired_at": "2024-12-12T17:49:43.000Z"
        }

The device_id I’ll then pass in the API call to the Terminal is: 952CS108A6002588 :slight_smile:

That worked! Thanks.