merchants_api = client.merchants
MerchantsApi
Provides details about the merchant associated with a given access token.
The access token used to connect your application to a Square seller is associated
with a single merchant. That means that ListMerchants
returns a list
with a single Merchant
object. 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 your application access.
If you know the merchant ID, you can also use the RetrieveMerchant endpoint to retrieve the merchant information.
def list_merchants(self,
cursor=None)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
int |
Query, Optional | The cursor generated by the previous response. |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type List Merchants Response
.
result = merchants_api.list_merchants()
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Retrieves the Merchant
object for the given merchant_id
.
def retrieve_merchant(self,
merchant_id)
Parameter | Type | Tags | Description |
---|---|---|---|
merchant_id |
str |
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 ApiResponse
instance. The body
property of this instance returns the response data which is of type Retrieve Merchant Response
.
merchant_id = 'merchant_id0'
result = merchants_api.retrieve_merchant(merchant_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)