Skip to content

Latest commit

 

History

History
98 lines (69 loc) · 2.72 KB

merchants.md

File metadata and controls

98 lines (69 loc) · 2.72 KB

Merchants

const merchantsApi = client.merchantsApi;

Class Name

MerchantsApi

Methods

List Merchants

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.

async listMerchants(  cursor?: number,
requestOptions?: RequestOptions): Promise<ApiResponse<ListMerchantsResponse>>

Parameters

Parameter Type Tags Description
cursor number | undefined Query, Optional The cursor generated by the previous response.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

ListMerchantsResponse

Example Usage

try {
  const { result, ...httpResponse } = await merchantsApi.listMerchants();
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch (error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Merchant

Retrieves the Merchant object for the given merchant_id.

async retrieveMerchant(  merchantId: string,
requestOptions?: RequestOptions): Promise<ApiResponse<RetrieveMerchantResponse>>

Parameters

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.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveMerchantResponse

Example Usage

const merchantId = 'merchant_id0';

try {
  const { result, ...httpResponse } = await merchantsApi.retrieveMerchant(merchantId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch (error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}