All URIs are relative to https://connect.squareup.com
Method | HTTP request | Description |
---|---|---|
listMerchants | GET /v2/merchants | ListMerchants |
retrieveMerchant | GET /v2/merchants/{merchant_id} | RetrieveMerchant |
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.
// 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();
}
Name | Type | Description | Notes |
---|---|---|---|
cursor | Integer | The cursor generated by the previous response. | [optional] |
- Content-Type: application/json
- Accept: application/json
RetrieveMerchantResponse retrieveMerchant(merchantId)
RetrieveMerchant
Retrieve a `Merchant` object for the given `merchant_id`.
// 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();
}
Name | Type | Description | Notes |
---|---|---|---|
merchantId | String | The ID of the merchant to retrieve. |
- Content-Type: application/json
- Accept: application/json