$merchantsApi = $client->getMerchantsApi();MerchantsApi
Returns Merchant information for a given access token.
If you don't know a Merchant ID, you can use this endpoint to retrieve the merchant ID for an access token.
You can specify your personal access token to get your own merchant information or specify an OAuth token
to get the information for the merchant that granted you access.
If you know the merchant ID, you can also use the RetrieveMerchant endpoint to get the merchant information.
function listMerchants(?int $cursor = null): ApiResponse| Parameter | Type | Tags | Description |
|---|---|---|---|
cursor |
?int |
Query, Optional | The cursor generated by the previous response. |
This method returns a Square\Utils\ApiResponse instance. The getResult() method on this instance returns the response data which is of type ListMerchantsResponse.
$cursor = 210;
$apiResponse = $merchantsApi->listMerchants($cursor);
if ($apiResponse->isSuccess()) {
$listMerchantsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Get more response info...
// $statusCode = $apiResponse->getStatusCode();
// $headers = $apiResponse->getHeaders();Retrieve a Merchant object for the given merchant_id.
function retrieveMerchant(string $merchantId): ApiResponse| Parameter | Type | Tags | Description |
|---|---|---|---|
merchantId |
string |
Template, Required | The ID of the merchant to retrieve. If the string "me" is supplied as the ID, then retrieve the merchant that is currently accessible to this call. |
This method returns a Square\Utils\ApiResponse instance. The getResult() method on this instance returns the response data which is of type RetrieveMerchantResponse.
$merchantId = 'merchant_id0';
$apiResponse = $merchantsApi->retrieveMerchant($merchantId);
if ($apiResponse->isSuccess()) {
$retrieveMerchantResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Get more response info...
// $statusCode = $apiResponse->getStatusCode();
// $headers = $apiResponse->getHeaders();