# How to connect your terminal (https://developer.godaddy.com/en/docs/api-users/commerce/accept-payments/in-person-payments/connect-terminal)

---
title: How to connect your terminal
description: >-
  Choose a supported GoDaddy terminal, get it ready, and find the deviceId that
  payment requests target.
keywords: >-
  connect terminal, Smart Terminal, Duo, Flex, Pro, deviceId, storeId, urn:tid,
  terminal setup, serialNumber, storeDevices, includeField, Payment Requests,
  in-person payments
agentNotes:
  permissions:
    - GoDaddy Payments
  scopes:
    - 'commerce.store:read'
  idempotent: true
  destructive: false
  failureRecovery: >-
    A 401 means the token is missing, expired, or lacks commerce.store:read. A
    404 means the storeId is wrong. On 429, wait for Retry-After and retry. On
    5xx, retry with backoff. This read is safe to retry. No serial match means
    no ACTIVATED terminal on this store has that serial number; contact GoDaddy
    support.
related:
  guides:
    - title: How to charge a card on a terminal
      href: >-
        /docs/api-users/commerce/accept-payments/in-person-payments/charge-a-card
    - title: How to get set up to accept payments
      href: /docs/api-users/commerce/accept-payments/before-you-start
    - title: About accepting payments
      href: /docs/api-users/commerce/accept-payments
    - title: How to handle the result
      href: >-
        /docs/api-users/commerce/accept-payments/in-person-payments/handle-result
  concepts:
    - title: About Payment Requests
      href: /docs/api-users/commerce/accept-payments/in-person-payments
    - title: Payment request reference
      href: /docs/api-users/commerce/accept-payments/in-person-payments/reference
    - title: About the Commerce API
      href: /docs/api-users/commerce
  apis:
    - title: Create a payment request
      href: /docs/references/rest/payments/create-payment-request
pageId: 4414d3bd-1c24-4f8b-8b37-d81267af8f12
---

## Overview

This page covers the GoDaddy terminals that take payment requests, how to get one ready, and how to find its `deviceId` with Commerce API v1.

A store represents one physical location, and a terminal belongs to exactly one store. A payment request names the store in its path and the terminal in `deviceId`. `deviceId` is optional on the create schema, but send it on every payment request so GoDaddy routes it to the terminal you chose. Go to [About Payment Requests](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/in-person-payments) for how the request flows from your server to the terminal.

If you don't include `deviceId`, the payment request is sent to all Smart Terminals in the store.

The following diagram shows how an account's stores and terminals relate:

## Prerequisites

The following prerequisites are required before you can connect your terminal:

* the GoDaddy Payments account and environment variables from [How to get set up to accept payments](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/before-you-start)
* your `storeId` in `STORE_ID`, from [About the Commerce API](https://developer.godaddy.com/docs/api-users/commerce#your-stores)
* a [Personal Access Token (PAT)](https://developer.godaddy.com/docs/api-users/auth/how-to) with the `commerce.store:read` scope
* the serial number printed on your terminal, in `SERIAL_NUMBER`
* [jq](https://jqlang.org/) for the curl tab

## Supported terminals

Payment requests run on the GoDaddy Smart Terminal Duo, Flex, and Pro. Buy the terminal for the account that owns the store.

Go to [GoDaddy Payments point of sale](https://www.godaddy.com/payments/point-of-sale) to compare models and buy a terminal.

## Get a terminal ready

GoDaddy configures each terminal for a store before shipping it, so you don't activate or set it up yourself. The store's `storeDevices` lists a configured terminal with the status `ACTIVATED` and a `deviceId`.

The following procedure gets a terminal ready:

1. Power on the terminal and connect it to the internet.
2. Confirm in person that the terminal is online before you send a payment request.

A payment stuck in `QUEUED` almost always means the terminal is offline or the `deviceId` is wrong. Confirm the terminal is online, and that `deviceId` names a terminal in the store in the path. A request can stay `QUEUED` for days, and you can clear it only on the terminal.

## Find your device ID

`GET /v1/commerce/stores/{storeId}?includeField=storeDevice` returns the store and every terminal registered to it. The call needs the `commerce.store:read` scope.

Each entry in `storeDevices` has a `status`. Match the serial number printed on the terminal, and use that terminal only when its `status` is `ACTIVATED`. A terminal that isn't `ACTIVATED` might omit `deviceId` and `serialNumber`. When the terminal you expect is missing or isn't `ACTIVATED`, contact GoDaddy support.

`deviceId` is `urn:tid:` followed by a UUID. Pass it unchanged, because the list filter matches `deviceId` exactly as you sent it on create. The API also accepts the bare UUID.

`externalTerminalId` isn't the `deviceId`, so don't send it on a payment request. MID and TID, the merchant and terminal identifiers the acquirer assigns, aren't the `deviceId` either.

The following procedure lists the `ACTIVATED` terminals for a store and matches one by the serial number printed on the terminal.

* List the `ACTIVATED` terminals and match one by `serialNumber`:

  ```bash tab="curl"
  if response=$(
    curl -sS -f "https://api.godaddy.com/v1/commerce/stores/$STORE_ID?includeField=storeDevice" \
      -H "Authorization: Bearer $GODADDY_PAT"
  ); then
    jq --arg sn "$SERIAL_NUMBER" '
        (.storeDevices // [])
        | map(select(.status == "ACTIVATED"))
        | (.[] | {deviceId, serialNumber}),
          (map(select(.serialNumber == $sn)) | .[0].deviceId // "no match")
      ' <<< "$response"
  else
    echo "request failed" >&2
  fi
  ```

  ```js tab="Node"
  const token = process.env.GODADDY_PAT;
  const storeId = process.env.STORE_ID;
  const serialNumber = process.env.SERIAL_NUMBER;

  const res = await fetch(
    `https://api.godaddy.com/v1/commerce/stores/${storeId}?includeField=storeDevice`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  if (!res.ok) {
    throw new Error(`${res.status} ${await res.text()}`);
  }
  const store = await res.json();

  const activated = (store.storeDevices ?? []).filter(
    (device) => device.status === "ACTIVATED"
  );
  console.log(
    activated.map((device) => ({
      deviceId: device.deviceId,
      serialNumber: device.serialNumber,
    }))
  );

  const match = activated.find((device) => device.serialNumber === serialNumber);
  console.log(match?.deviceId ?? "no match");
  ```

  ```python tab="Python"
  import os, requests

  token = os.environ["GODADDY_PAT"]
  store_id = os.environ["STORE_ID"]
  serial_number = os.environ["SERIAL_NUMBER"]

  res = requests.get(
      f"https://api.godaddy.com/v1/commerce/stores/{store_id}",
      params={"includeField": "storeDevice"},
      headers={"Authorization": f"Bearer {token}"},
  )
  res.raise_for_status()
  devices = res.json().get("storeDevices") or []

  activated = [d for d in devices if d.get("status") == "ACTIVATED"]
  for device in activated:
      print(device.get("deviceId"), device.get("serialNumber"))

  match = next(
      (d for d in activated if d.get("serialNumber") == serial_number), None
  )
  print(match["deviceId"] if match else "no match")
  ```

  ```go tab="Go"
  package main

  import (
  	"encoding/json"
  	"fmt"
  	"io"
  	"net/http"
  	"os"
  )

  type storeDevice struct {
  	DeviceID     string `json:"deviceId"`
  	SerialNumber string `json:"serialNumber"`
  	Status       string `json:"status"`
  }

  type store struct {
  	StoreDevices []storeDevice `json:"storeDevices"`
  }

  func main() {
  	token := os.Getenv("GODADDY_PAT")
  	storeID := os.Getenv("STORE_ID")
  	serialNumber := os.Getenv("SERIAL_NUMBER")

  	url := fmt.Sprintf(
  		"https://api.godaddy.com/v1/commerce/stores/%s?includeField=storeDevice",
  		storeID,
  	)
  	req, err := http.NewRequest("GET", url, nil)
  	if err != nil {
  		panic(err)
  	}
  	req.Header.Set("Authorization", "Bearer "+token)

  	res, err := http.DefaultClient.Do(req)
  	if err != nil {
  		panic(err)
  	}
  	defer res.Body.Close()

  	body, err := io.ReadAll(res.Body)
  	if err != nil {
  		panic(err)
  	}
  	if res.StatusCode != http.StatusOK {
  		panic(fmt.Sprintf("%d %s", res.StatusCode, body))
  	}

  	var s store
  	if err := json.Unmarshal(body, &s); err != nil {
  		panic(err)
  	}

  	matched := "no match"
  	for _, device := range s.StoreDevices {
  		if device.Status != "ACTIVATED" {
  			continue
  		}
  		fmt.Println(device.DeviceID, device.SerialNumber)
  		if matched == "no match" && device.SerialNumber == serialNumber {
  			matched = device.DeviceID
  		}
  	}
  	fmt.Println(matched)
  }
  ```

## Example response

The following response shows an `ACTIVATED` terminal and a `CREATED` terminal. Only the `ACTIVATED` terminal has a `deviceId`, and the store identifier is `id`:

```json
{
  "id": "$STORE_ID",
  "storeDevices": [
    {
      "deviceId": "$DEVICE_ID",
      "externalTerminalId": "$EXTERNAL_TERMINAL_ID",
      "serialNumber": "$SERIAL_NUMBER",
      "status": "ACTIVATED",
      "type": "TERMINAL"
    },
    {
      "status": "CREATED",
      "type": "TERMINAL"
    }
  ]
}
```

## Common errors

The following table lists common situations when you connect your terminal and what to do:

| Situation                                             | Most likely cause                                                                          | What to do                                                                             |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| The lookup prints `no match`                          | `SERIAL_NUMBER` differs from the terminal, or the terminal isn't `ACTIVATED` on this store | Check the serial number. If it matches, contact GoDaddy support with the serial number |
| The terminal is missing from `storeDevices`           | GoDaddy configured it for a different store                                                | Contact GoDaddy support with the serial number and your `storeId`                      |
| `401`                                                 | A missing, expired, or invalid PAT, or a missing `commerce.store:read` scope               | Create a token with `commerce.store:read`                                              |
| `404`                                                 | A wrong `storeId`                                                                          | Check `STORE_ID`                                                                       |
| A payment request fails with `EXTERNAL_SERVICE_ERROR` | An unknown `deviceId`                                                                      | Look up the `deviceId` again, then retry with a new `paymentRequestId`                 |

Go to [How to charge a card on a terminal](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/in-person-payments/charge-a-card) for the create call that uses the `deviceId`.
