What it Does: The Mobile Authorization API
The Mobile Authorization API accepts an account credential (OAuth token or Personal Access Token) and location ID and returns an authorization code that custom mobile apps can use to initialize Square mobile solutions like Reader SDK to accept payments using Square hardware.
The Mobile Authorization API accepts requests through HTTPS and TLS 1.2. Connections through HTTP are not supported.
The Mobile Authorization API is not supported in the Square sandbox. See the Testing mobile apps for alternative recommendations.
In addition, the sample code in this guide makes the following assumptions:
The authorization service uses PHP version 5.4 or later. We use PHP for example code because it is a common web language and relatively approachable for new developers, but Square APIs are language agnostic and the setup steps are comparable across languages.
The authorization service uses the Square Connect v2 PHP SDK. Installing the SDK is optional. As long as you can package and receive JSON messages you can use Square APIs, but installing the SDK makes things easier.
The In-App Payments SDK does not use the Mobile Authorization API.
The Mobile Authorization API is part of the Square Connect v2 API suite and is comprised of a client API instance, authorization request body, and authorization response body. It inherits the Connect Configuration object so that the API client can be initialized with an access token such as an OAuth or personal access token.
To make calls with this API, a developer must create a backend service that uses the OAuth API to take a user through the OAuth flow to get an authentication token. The token is used by the Mobile Authorization API to get a short-lived authorization code for used with Reader SDK.
The mobile authorization flow is initiated by mobile device logic in a call to the backend service and is completed when the backend service returns a mobile authorization code to the mobile app.
Use the build guides below to integrate with Mobile Authorization API.