POS Application Integration with the Terminal API

Integrating a Point of Sale (POS) application with the Terminal API requires using the Devices API to pair the POS application with the Square Terminal using a device code and connecting the Square Terminal to Square for processing payments.

Link to section

How the pairing works

A POS application cannot be physically connected to a Square Terminal but must be paired using the Devices API and a wireless Internet connection before a checkout can be processed.

The Devices API pairs a POS application with a Square Terminal as long as the Square Terminal is wirelessly connected to Square. The Devices API lets the application request a pairing and returns a device code for the seller to use. The request is sent to Square, which then directly connects to the Square Terminal using the wireless connection. When the connection is made, Square sends the device code back to the application.

The following request example uses the Devices API CreateDeviceCode endpoint to send the request:

Create device code

To obtain the device code, you need the DEVICE_CREDENTIAL_MANAGEMENT OAuth permission enabled so that you can use the Devices API to connect to the Square Terminal.

The seller uses the device code to sign in to a Square Terminal. After the seller signs in, the Devices API returns the unique ID of the Square Terminal as a DeviceCode.device_id. The ID is used in later Terminal checkout requests.

Important

The Seller Dashboard also generates device codes; however, they won't work for successfully pairing to a Square Terminal. Make sure that you use the device code that the Devices API generated, and not the device code from the Seller Dashboard.

The following response example shows the generated unique ID of the Square Terminal:

{ "device_code": { "id": "AF7AJW6VM31P3", "name": "Terminal API Device created on Sep 14, 2022", "code": "JHHYHH", "product_type": "TERMINAL_API", "location_id": "NHTLE2589dCGJ", "pair_by": "2022-09-15T00:01:18.000Z", "created_at": "2022-09-14T23:56:18.000Z", "status": "UNPAIRED", "status_changed_at": "2022-09-14T23:56:18.000Z" } }

The Devices API DeviceCode object represents a POS application/Square Terminal pairing. It contains the sign-in code, pairing status, and device ID of the Square Terminal.

When the Square Terminal is paired, the application can send checkout requests using the Terminal API. The Square Terminal uses the wireless connection with Square to get payment information from the request and collect the payment from the buyer.

Note

You can see the device pairing state in the Seller Dashboard by choosing Accounts & Settings, and then choosing Devices.

Whether accessed through the Devices API or the Seller Dashboard, the DeviceCode object represents whether the device code has been used to sign in to a Terminal device. It doesn't represent the current status of the device.

For a complete list of Devices API OAuth permissions to configure the Square Terminal, see OAuth Permissions Reference.

Link to section

Next step

To get started with pairing a POS application to a Square Terminal, see Connect a Square Terminal to a POS Application.