Retrieving all merchants
It's possible to retrieve a list of all merchants that the logged in user has access to. The returned list contains merchant id's and merchant name's. To get complete details of a merchant it is necessary to use the retrieve merchant api call using one of the returned id's.
Client client = new Client();
client.SetBasicAuth("[email protected]", "notArealpassw0rd");
var merchants = client.GetMerchantsAsync().Result;
ClientName firstMerchant = merchants[0];
Console.WriteLine("Name: {0}", firstMerchant.Name);
Console.WriteLine("MerchantId: {0}", firstMerchant.MerchantId);
// Example output:
// Name: Test Merchant
// MerchantId: 9900000301
ApiClient defaultClient = Configuration.getDefaultApiClient();
HttpBasicAuth auth = (HttpBasicAuth)defaultClient.getAuthentication("basicAuth");
auth.setUsername("[email protected]);
auth.setPassword("notArealpassw0rd");
MerchantsApi apiInstance = new MerchantsApi();
List<ClientName> allMerchants = apiInstance.getMerchants();
ClientName firstMerchant = allMerchants.get(0);
System.out.println("Name: " + firstMerchant.getName());
Console.WriteLine("MerchantId: " + firstMerchant.getMerchantId());
// Example output:
// Name: Test Merchant
// MerchantId: 9900000301
[[ACHConfiguration sharedConfig] username] = @"[email protected]";
[[ACHConfiguration sharedConfig] password] = @"notArealpassword";
ACHMerchantsApi *apiInstance = [[ACHMerchantsApi alloc] init];
[apiInstance getMerchantsWithCompletionHandler:^(NSArray<ACHClientName> *output, NSError *error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error calling ACHMerchantsApi->getMerchantsWithCompletionHandler: %@", error);
}
}];
// Example output
/*
(
"{\n merchantId = 9900000301;\n name = \"Test Merchant\";\n}"
)
*/
Updated about 6 years ago