Manage Merchants
General
When creating a new merchant you can specify its name, a reference key and an optional priority parameter. After creating a merchant, you can additionally configure contact information, carriers and return addresses, using the dedicated endpoints. Please also find the next sections for more details.
Admin API
Create Merchant
When creating a merchant, you need to define a name, a reference key and optionally a priority.
Parameter | Details |
---|---|
id | Integer READ-ONLY The ID of the merchant created by SCAYLE. |
referenceKey | String Reference key of the merchant. |
name | String Name of the merchant. |
priority | Integer Priority of the merchant. |
let newMerchant = {
name: "ACME",
referenceKey: "acme",
priority: 1
};
let response = await adminApi.apis.Merchants.createMerchant({}, {requestBody: newMerchant});
let createdMerchant = response.body;
console.log(createdMerchant.id);
Update Merchant
This method is used to update an existing merchant.
Parameter | Details |
---|---|
id | Integer READ-ONLY The ID of the merchant created by SCAYLE. |
referenceKey | String Reference key of the merchant. |
name | String Name of the merchant. |
priority | Integer Priority of the merchant. |
let response = await adminApi.apis.Merchants.getMerchant({merchantIdentifier: 1});
let merchant = response.body;
merchant.priority = 10;
response = await adminApi.apis.Merchants.updateMerchant({merchantIdentifier: merchant.id}, {requestBody: merchant});
let updatedMerchant = response.body;
console.log(updatedMerchant.priority);
Get Merchant
You can get merchant information by its reference key or ID.
Parameter | Details |
---|---|
with | String Allows to load the following nested resources within this request:
|
response = await adminApi.apis.Merchants.getMerchant({merchantIdentifier: 1});
let merchant = response.body;
console.log(merchant.name);
Get a Collection of Merchants
You can request multiple merchants and refine the search results by applying filter options.
Parameter | Details |
---|---|
limit | Integer Maximum number of items in the result. (default: |
filters[id] | String Comma-separated list of merchant IDs that should be used for filtering. |
filters[minId] | Integer Minimum ID of merchants that should be returned. |
filters[maxId] | Integer Maximum ID of merchants that should be returned. |
with | String Allows to load the following nested resources within this request:
|
Parameter | Details |
---|---|
entities | Merchant A collection of merchants. |
cursor | Cursor An object containing information for use in pagination. |
Get a List of 10 Merchants
let response = await adminApi.apis.Merchants.getMerchants({
limit: 10
});
let merchants = response.body.entities;
merchants.forEach(
merchant => console.log(merchant.name)
);
Merchant Contacts
Create Merchant Contact
You can add multiple contacts to a merchant.
Parameter | Details |
---|---|
id | Integer READ-ONLY The ID of the contact created by SCAYLE. |
name | String The name of the contact. |
email | String The email of the contact. |
phone | String The phone of the contact. |
cellPhone | String The cell phone of the contact. |
type | String The type of the contact. |
position | String The position of the contact. |
description | String The description of the contact. |
let newContact = {
email: "[email protected]",
phone: "123456789",
cellPhone: "123456789",
name: "John Doe",
type: "general",
position: "Partner Service",
description: "Additional information"
};
let response = await adminApi.apis.Merchants.createMerchantContact({merchantIdentifier: 1}, {requestBody: newContact});
let createdContact = response.body;
console.log(createdContact.id);
Get a Merchant Contact
You can get merchant contact information by its ID.
let response = await client.apis.Merchants.getMerchantContact({merchantIdentifier: 1, merchantContactId: 1});
let contact = response.body;
console.log(contact.id);
Get a Collection of Merchant Contacts
Parameter | Details |
---|---|
limit | Integer Maximum number of items in the result. (default: |
filters[id] | String Comma-separated list of merchant contact IDs that should be used for filtering. |
filters[minId] | Integer Minimum ID of merchant contacts that should be returned. |
filters[maxId] | Integer Maximum ID of merchant contacts that should be returned. |
Parameter | Details |
---|---|
entities | MerchantContact A collection of merchant contacts. |
cursor | Cursor An object containing information for use in pagination. |
let response = await adminApi.apis.Merchants.getMerchantContacts({merchantIdentifier: 1});
let contacts = response.body.entities;
contacts.forEach(
contact => console.log(contact.id)
);
Update Merchant Contact
Parameter | Details |
---|---|
id | Integer READ-ONLY The ID of the contact created by SCAYLE. |
name | String The name of the contact. |
email | String The email of the contact. |
phone | String The phone of the contact. |
cellPhone | String The cell phone of the contact. |
type | String The type of the contact. |
position | String The position of the contact. |
description | String The description of the contact. |
let merchantId = 1;
let response = await adminApi.apis.Merchants.getMerchantContact({merchantIdentifier: merchantId, merchantContactId: 1});
let contact = response.body;
contact.phone = "123456789";
response = await adminApi.apis.Merchants.updateMerchantContact({merchantIdentifier: merchantId, merchantContactId: contact.id}, {requestBody: contact});
contact = response.body;
console.log(contact.phone);
Delete Merchant Contact
Parameter | Details |
---|---|
id | Integer READ-ONLY The ID of the contact created by SCAYLE. |
name | String The name of the contact. |
email | String The email of the contact. |
phone | String The phone of the contact. |
cellPhone | String The cell phone of the contact. |
type | String The type of the contact. |
position | String The position of the contact. |
description | String The description of the contact. |
await adminApi.apis.Merchants.deleteMerchantContact({merchantIdentifier: 1, merchantContactId: 1});