$mobileAuthorizationApi = $client->getMobileAuthorizationApi();
MobileAuthorizationApi
Generates code to authorize a mobile application to connect to a Square card reader.
Authorization codes are one-time-use codes and expire 60 minutes after being issued.
Important: The Authorization
header you provide to this endpoint must have the following format:
Authorization: Bearer ACCESS_TOKEN
Replace ACCESS_TOKEN
with a
valid production authorization credential.
function createMobileAuthorizationCode(CreateMobileAuthorizationCodeRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateMobileAuthorizationCodeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
CreateMobileAuthorizationCodeResponse
$body = new Models\CreateMobileAuthorizationCodeRequest;
$body->setLocationId('YOUR_LOCATION_ID');
$apiResponse = $mobileAuthorizationApi->createMobileAuthorizationCode($body);
if ($apiResponse->isSuccess()) {
$createMobileAuthorizationCodeResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Get more response info...
// $statusCode = $apiResponse->getStatusCode();
// $headers = $apiResponse->getHeaders();