MerchantsApi

November 20, 2019 ยท View on GitHub

All URIs are relative to https://connect.squareup.com

MethodHTTP requestDescription
listMerchantsGET /v2/merchantsListMerchants
retrieveMerchantGET /v2/merchants/{merchant_id}RetrieveMerchant

listMerchants

ListMerchantsResponse listMerchants(cursor)

ListMerchants

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.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.MerchantsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

MerchantsApi apiInstance = new MerchantsApi();
Integer cursor = 56; // Integer | The cursor generated by the previous response.
try {
    ListMerchantsResponse result = apiInstance.listMerchants(cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling MerchantsApi#listMerchants");
    e.printStackTrace();
}

Parameters

NameTypeDescriptionNotes
cursorIntegerThe cursor generated by the previous response.[optional]

Return type

ListMerchantsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveMerchant

RetrieveMerchantResponse retrieveMerchant(merchantId)

RetrieveMerchant

Retrieve a `Merchant` object for the given `merchant_id`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.MerchantsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

MerchantsApi apiInstance = new MerchantsApi();
String merchantId = "merchantId_example"; // String | The ID of the merchant to retrieve.
try {
    RetrieveMerchantResponse result = apiInstance.retrieveMerchant(merchantId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling MerchantsApi#retrieveMerchant");
    e.printStackTrace();
}

Parameters

NameTypeDescriptionNotes
merchantIdStringThe ID of the merchant to retrieve.

Return type

RetrieveMerchantResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json