Ecwid Partner API
Ecwid Partner API
Getting a list of all stores that are registered for the given partner
Single Sign On to the control panel using the Developer API and store access tokens
Billing Rules
- billing (optional): set billing period for the account subscription. Possible values: monthly,
annual. If parameter is not set then monthly value is used by default.
- is_trial (optional): enables trial period for the store. Possible values: false, true.
Type of value should be string (mandatory). Use this parameter to subscribe store to the trial
version of paid plan. Number of days in trial period is set individually for every partner’s plan. If
parameter is not set then false value is used by default. Ecwid will not bill partner for the
duration of free trial. After free trial expires partner will be billed according to selected plan rates.
If customer did not subscribe for the services partner must suspend/delete account at the end of
free trial period to avoid charges for this account.
- ip (optional): IP address of owner. It will be used to detect owner’s location and automatically
configuring store defaults (including time zone and default language) for that location. If you
don’t know IP but know the country of the owner, just specify any IP belonging to the country to
correctly pre-configure the store defaults.
- timezone (optional) Time zone of the store. (e.g. America/New_York, Europe/London,
Asia/Tokyo, Africa/Johannesburg see timezones in Ecwid backend for the full list).
- defaultlanguage (optional) Storefront default language. Two letter language code (e.g. en, fr,
exceptions: es_419, pt_BR)
- profile_id (optional) assign a new store to the existing profile ID in Ecwid (see Profile-based
Ecwid SSO for resellers for more details)
- returnProfileId (optional) if set to 'true' profile ID will be returned in response in addition to the
store ID. The profile ID format is a string starting with a 'p' and following with numbers. Example:
p987654321
- template (optional): a store template as an XML file attachment, containing settings, demo
products and demo orders of a new store. The default template is described here. The default is
applied on any store creation. You can change the new store settings and data by supplying
your own template XML. To do that, download the default template and read comments in the
XML document. You can either copy the entire template, or just any part you wish to change, as
long as the structure preserves. For example, the following template file will replace the default
<shippingAndTaxSettings>, effectively installing different zones:
<template><owner><storeConfiguration>
<shippingAndTaxSettings>
<shippingSettings></shippingSettings>
<taxSettings></taxSettings>
<world id="WORLD">
<name>The World</name>
</world>
<zones id="1">
<countryCodes>US</countryCodes>
<countryCodes>UM</countryCodes>
<countryCodes>VI</countryCodes>
<name>USA</name>
</zones>
</shippingAndTaxSettings>
</storeConfiguration></owner></template>
- “Accept-Language” HTTP header can be used as usual to specify the store’s language. If
missing, English language is used.
Here is a more advanced example that configures PayPal Standard payment gateway by
default and disables the “Phone order” payment method.
It is possible to mark account for different purposes for example to distinguish test and
production accounts, or mark account as belonging to sub-partner. For this purpose it is
necessary to use the <source> element in XML template when creating a new account:
<owner>
<source>test_account</source>
..
</owner>
or
<owner>
<source>sub-partner name</source>
..
</owner>
Later you can access value of source parameter using API function status
If a new account/store is created successfully, Ecwid will return the 200 OK HTTP status and
this code:
Example in Java
The following example demonstrates using a template attachment in Java programming
language. The following libraries are required to run the example:
Commons HttpClient 3.1, Commons Codec, Dom4j for parsing the response.
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.methods.multipart.*;
import org.apache.commons.httpclient.params.*;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
/**
* Example Java code for creating a store using reseller API and a custom template defining
* one geographical zone.
*/
public class TestClient {
public static void main(String[] args) throws Exception {
HttpClient client = new HttpClient();
PostMethod post = new
PostMethod("https://my.ecwid.com/resellerapi/v1/register?register=y");
String xml =
"<template><owner><storeConfiguration>"+
"<shippingAndTaxSettings>"+
"<shippingSettings></shippingSettings>"+
"<taxSettings></taxSettings>"+
"<world id=\"WORLD\">"+
"<name>The World</name>"+
"</world>"+
"<zones id=\"1\">"+
"<countryCodes>US</countryCodes>"+
"<countryCodes>UM</countryCodes>"+
"<countryCodes>VI</countryCodes>"+
"<name>USA</name>"+
"</zones>"+
"</shippingAndTaxSettings>"+
"</storeConfiguration></owner></template>"
;
Part[] parts = {
new StringPart("email", "[email protected]"),
new StringPart("name", "Tester Tester"),
new StringPart("password", "tester"),
new StringPart("key", "12345"),
new StringPart("plan", "ECWID_FREE"),
new FilePart("template", new ByteArrayPartSource("template.xml",
xml.getBytes("UTF-8")))
};
HttpMethodParams params = new HttpMethodParams();
post.setRequestEntity(new MultipartRequestEntity(parts, params));
if (client.executeMethod(post) != 200) {
System.err.println("Error creating store: " + post.getStatusLine());
return;
}
To unsubscribe from the current plan to the default one make a GET or POST request to this
URL:
https://my.ecwid.com/resellerapi/v1/unsubscribe
with these parameters:
● ownerid: the Ecwid store ID, as an integer number
● key: your reseller API key previously used to create the account
This will stop your current subscription for the account and bring it back to the free plan, defined
for the partner. The same result can be achieved by calling /subscribe and specifying your
default plan name in the plan parameter.
If the request succeeds, the response 200 OK is returned, and the new expiration date is
provided in the following XML format:
<subscribe-response>
<expirationDate>2012-05-20T06:44:53.627-04:00</expirationDate>
</subscribe-response>
If the new subscription has no expiration date, the empty xml is returned:
<subscribe-response/>
If the request fails, the response will contain the reason for the failure, for example:
HTTP ERROR 400
Problem accessing /400. Reason:
Plan 'TEST' not found for partner TestPartner
https://my.ecwid.com/resellerapi/v1/resume
On success, both calls return HTTP status 200. Suspending an already suspended account and
resuming an already active account makes no effect and returns status code 200.
Deleting a user account
If you want to delete an account, you should make GET or POST HTTP request to the following
URL:
https://my.ecwid.com/resellerapi/v1/delete
On success, you will see HTTP status 200. If you cannot delete an account (e.g. it wasn't
created by you), the 403 HTTP error will be returned.
Important notice: deleting account does not remove its billing records. At the end of the billing
cycle you will be invoiced for the period that account was active.
On success, it will return HTTP status 200 and an XML document listing apps installed,
information about the store subscription and billing, plan features enabled/disabled, shipping
and payment configuration, tax settings and zones.
https://my.ecwid.com/resellerapi/v1/status
The parameters are:
● ownerid - the Ecwid store ID, as an integer number
● key - your reseller API key which was used to create the account
On success, the call returns HTTP status 200 and the XML document with the following tags:
● ownerid - echoes the ownerid in the request
● profile_id - Ecwid profile ID associated with this store
● suspended - “true” if the store was suspended
● closed - “true” is the store was closed by the user
● email - the current email of the account
● name - the person name in the account profile
● traffic - amount of web traffic consumed by the store since the start of the month
● storage - amount of billable storage occupied by the store, including store images and
files.
● shippingAndTaxSettings - current zones, shipping and tax settings
● account-type - information about the subscription. The most useful tag there is
subscription/originalProduct, which contains the current user’s plan.
● carrier-settings - (deprecated)
● paymentmethods - payment method list
● total - total of all orders in the store currency, except unfinished orders.
● currency - store currency ISO code
● productCount - product count
● categoryCount - category count
● source - value of source parameter that was defined during account creation. If not
defined the tag is missing
If the store with such ID does not exist, the call returns HTTP status 404.
If the store does not belong to your API key, the call returns HTTP status 403.
1 <storeList>
2 <stores>
3 <id>STORE ID</id>
4 <channelId>PARTNER ID</channelId>
5 <name>Store name</name>
6 <nick>Store owner's nickname</nick>
7 <email>Store owner's email</email>
8 <url>Store URL</url>
9 <planName>Name of partner plan</planName>
10 <planChangeableByReseller>either 'true' or 'false'</planChangeablebyReseller>
11 <planExpiration>Plan expiration date</planExpiration>
12 <suspended>'Suspended' status, either 'true' or 'false'</suspended>
13 <test>’true’ for test accounts and ‘false’ for others</test>
14 <trial>’true’ for trial subscriptions and ‘false’ for life</test>
15 <traffic>Traffic consumed since start of the month, bytes</traffic>
16 <storage>Storage consumed by the store data, bytes</storage>
17 <registered>Store registration date</registered>
</stores>
...more store data...
<sendCancellationEmailToBillingManager>true</sendCancellationEmailToBillingMa
nager>
<suspendWhenExpired>false</suspendWhenExpired>
<title>Test Plan Title</title>
<trialDays>14</trialDays>
</plans>
...
</planList>
If the request fails, the reason for the failure is returned.
Please note that Single Sign On to control panel using the Developer API is now available and
have more functionality. We recommend to switch to the Developer API SSO.
In order to login a user into Ecwid store control panel, the control panel should be opened
through the following URL:
https://my.ecwid.com/cp/partner-login?ownerid=[ID]&t=[TIMESTAMP]&login_sha1token=[TOK
EN]&place=[PAGE_HASH]&logout_url=[LOGOUT_URL]&upgrade_url=[UPGRADE_URL]&lang=[LANGUAG
E_CODE]&inline&profile_id=[PROFILE_ID]
For private label partners my.ecwid.com may be substituted with the domain where partner’s control panel
is located.
where
● [ID] - Store ID, e.g. 1003
● [PROFILE_ID] (optional) - log in to specified profile id (see Profile-based Ecwid SSO for resellers
for more details)
● [TIMESTAMP] - unix timestamp of a token creation time. Time should be in UTC and
timestamp should be in seconds.
● [TOKEN] - the token itself that is a SHA1 hash of concatenation of the following
parameters: timestamp + store_id + channel_id + partner_api_key
Please generate the token in lowercase (mandatory!)
● [PAGE_HASH] - (optional) the hash part of control panel page’s URL-address that
should be opened after sign-on (Dashboard page if was not defined)
● [LOGOUT_URL] - Ecwid will redirect a user to this URL if his/her session is expired.
Usually it is URL of a partner’s control panel or “log in” page.
● [UPGRADE_URL] - allows setting an upgrade URL for every partner’s store. Ecwid will
redirect a user to this URL if he/she clicks any upgrade button within store Control panel
(e.g. http://take.ms/l7qnX ). For more information on upgrade URLs format refer to
Define upgrade URLs
● [LANGUAGE_CODE] - a two letter language code for the store control panel
● [inline] - (optional) displays control panel in iframe friendly manner with header and
footer removed
The UPGRADE_URL parameter works in the following way:
- When passing a value via UPGRADE_URL - that value is assigned as Upgrade
URL for that particular store.
- When passing empty value via UPGRADE_URL - a current Upgrade URL for that
store is reset. In this case, one of two options is possible:
a) If Channel_Upgrade_URL (URL that is set for a partner on the Ecwid side) is set,
Ecwid will redirect a user to that Channel_Upgrade_URL.
b) If Channel_Upgrade_URL is not set, a user will not be redirected anywhere and
just see a popup with an explanatory text, e.g. http://take.ms/2ymqu .
- If UPGRADE_URL is not passed at all - a current Upgrade URL (that was set
earlier) is used.
Ecwid Control Panel is often embedded in a partner service in a form of an iframe. In this
case, when a merchant clicks upgrade button, Ecwid can send a postmessage to the
"parent" window and then the partner admin interface handles it accordingly. For
example, the partner can show a popup where the merchant chooses a plan and then is
directed to finish the upgrading process http://take.ms/aZrjQ.
When clicking Upgrade buttons, Ecwid sends postmessage in the following format:
{ event: 'upgrade-link-click', feature: 'coupons', plan: 'PARTNER_PLAN_NAME' },
where
feature: name of a feature an upgrade button was clicked for;
plan: name of a plan where the feature is available.
Please note that the option to send upgrade postmessage can be enabled on the partner
channelID level, in this case, postmessages will be sent for all stores of the partner.
If you need this option please let the Ecwid Bizdev team know.
Please note:
- A token is valid for 5 minutes from the time specified in the timestamp
- The URL provided works with HTTPS only, not HTTP
- It is possible to autologin users only into the stores that were created by partner via Partner
API
- SSO session will expire in 27 hours after the last active RPC request from the control panel.
So if the control panel is open in your browser it will keep sending heartbeats and the session
will not expire.
echo
"https://my.ecwid.com/cp/partner-login?ownerid=$store_id&t=$time&login_sha1token=$token&place=
order&logout_url=http://example.com&upgrade_url=http://billing.com" . "\n";
?>
For seamless customer experience it is possible to embed Ecwid control panel into a third party
product using seamless iframe. Please make sure that you are using the Ecwid SSO for
seamless customer experience. The iframe will automatically adjust its height depending on the
content of control panel page. Below is an example of simple HTML page with embedded Ecwid
control panel:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<script type='text/javascript'>//<![CDATA[
window.onload=function(){
// Create IE + others compatible event handler
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
$(document).ready(function(){
$('#ecwid-frame').css('height', '700px');
$('#ecwid-frame').attr('src', 'https://my.ecwid.com/cp/CP.html?inline');
});
}//]]>
</script>
<div id="wrap">
<iframe seamless id="ecwid-frame" frameborder="0" width="100%" height="700"
scrolling="no"></iframe>
</div>
</body>
</html>
You can natively implement buttons in your product to save changes in the Ecwid control panel.
This is useful if you display an Ecwid control panel in a webview of a mobile app or want to have
your original controls to save changes.
Please note that Save page functions described below won’t work when the control panel is
embedded in an iframe.
To hide Ecwid save button use parameter: hide_save_button=true when embedding control
panel e.g. https://my.ecwid.com/cp/CP.html?inline&hide_save_button=true
To control saving data in Ecwid control panel please use the following Javascript API functions:
Note: when customer leaves Ecwid control panel with unsaved changes it will display popup
with warning to save changes even if save button is hidden.
In some cases it is necessary to load Ecwid widgets simultaneously with loading of a web page.
This way of loading is called Static loading. For example, sitebuilders can load Ecwid widgets
statically when customers publish their websites (with a store) live.
Please refer to the following articles to find more information regarding the Ecwid widgets
including embed codes:
Horizontal Categories - displays product categories in the horizontal list with tabs
[IMPORTANT]:
- Use a correct domain in the script.js
In the articles below the ecwid.com is used in the script.js (https://app.ecwid.com/script.js?...)
Please note that this correct for partners who use ecwid.com as the domain for their store
Control panel.
If another domain is set as the domain for partner stores Control panel, in this case a partner
should use that custom domain in the script.js.
Please contact with Ecwid Bizdev team and clarify your domain for the store CP and other
questions regarding the script.js if any.
Please review Ecwid demo store as an example of static embedding of the widgets:
https://mdemo.ecwid.com/
Dynamic Embedding of Ecwid Widget
In some cases it is necessary to dynamically create and destroy Ecwid widget within HTML
page. This is useful for dynamic sitebuilders that switch to online store page without actually
reloading page (e.g. making it visible). You should use window.ecwid_dynamic_widgets variable to
enable dynamic widget creating in Ecwid. See the example below that shows how to create and
destroy Ecwid widget through javascript functions.
Please note that this method allows to embed the Product browser widget only. If you need to
embed other widgets dynamically, please, use the code for deferred widget initialization (next
point).
Please note that this method is slower than direct embedding of Ecwid widget so you should
use it only if you need dynamic widget creation.
<div id="my-store-1003"></div>
<script>
window.ecwid_script_defer = true;
window.ecwid_dynamic_widgets = true;
if (!document.getElementById('ecwid-script')) {
var script = document.createElement('script');
script.charset = 'utf-8';
script.type = 'text/javascript';
script.src = 'https://app.ecwid.com/script.js?1003';
script.id = 'ecwid-script'
document.body.appendChild(script);
} else {
ecwid_onBodyDone();
}
</script>
Deferred Initialization of Ecwid Widget
Sometime it is necessary to delay widget initialization while host page finish initialization
procedures. This is useful when host site is built dynamically using libraries such as React js.
<div id="my-store-1003"></div>
<div id="productBrowser"></div>
<script>
window.ecwid_script_defer = true;
var script = document.createElement('script');
script.charset = 'utf-8';
script.type = 'text/javascript';
script.src = 'https://app.ecwid.com/script.js?1003';
document.getElementById('my-store-1003').appendChild(script);
window._xnext_initialization_scripts = [
{ widgetType: 'ProductBrowser', id: 'productBrowser', arg: [
'"categoriesPerRow=3","views=grid(4,4) list(10)
table(20)","categoryView=grid","searchView=list","style=","responsive=yes","id=productBrowser"'
]}
];</script>
Ecwid widgets are indexed by Google. However Google is indexing HTML pages faster and
deeper than dynamic Javascript widgets. So as a measure to improve indexing you can use
Static Store Pages API https://api-docs.ecwid.com/reference/static-store-pages to add
indexable HTML content to your store.
This method will work only if your page with Ecwid widget is generated dynamically with a server
side script e.g. Python, PHP, ASP etc. You need to add a piece of code to your page that
fetches the HTML version of a store page and insert it into your page. Static Store Pages API
also returns Meta tags and Open Graph tags it is highly recommended to insert them into your
page as well.
You should do it dynamically each time the store page is loaded in the customer’s browser.
Google bot will continue following links in the static page and will index the entire product
catalog.
Store customers will be interacting with the dynamic Ecwid widget. To prevent customers from
seeing a static copy of the store page you need to add a Javascript code that will hide the static
part.
You can use the code example provided below for hiding static content:
function createClass(name,rules) {
style.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(style);
if(!(style.sheet||{}).insertRule)
else
style.sheet.insertRule(name+'{'+rules+'}',0);
createClass('#html_selector', 'display:none;');
</script>
<div id=’#html_selector’>
Static HTML code here
</div>
Sample code in PHP for extracting productid and categoryid from SEO friendly URL
<?
$pattern = '!.*-(p|c)([0-9]+)(\/.*|\?.*)?$!';
if( preg_match( $pattern, $current_url, $matches ) ) {
return array();
}
$modes = array(
'p' => 'product',
'c' => 'category'
);
return array( 'mode' => $modes[$matches[1]], 'id' => $matches[2] );
?>
Returned values:
mode = product - this is a product page
mode = category - this is a category page
mode is empty - this is a home page
id - productid or categoryid. Use it when calling the Static Pages API.
We recommend to cache static content on your side to provide better site performance. You
should use the Store Changes Stats API endpoint to determine when the cache becomes
obsolete. productsUpdated and categoriesUpdated fields provide an indication when it is
necessary to refresh cache.
window.addEventListener('load', function(e) {
setupEcwidPopupCentering('#myframe');
});
</script>
setupEcwidPopupCentering() function accepts one argument, which is the ID of an iframe element, where
Ecwid storefront is loaded. In order to work, setupEcwidPopupCentering() function needs to have
iframeintegration.js file loaded for that frame.
{
'action': 'pageLoad',
'data': {
'page': {
'title': 'Catalog',
'path': 'products',
}
},
'height': 1200
}
This functionality is useful when creating deep product integration with Ecwid. For example change
content of parent window depending on the page opened in Ecwid control panel.
Ecwid will change its main colors depending on website colors and will automatically calculate all
intermediate colors in the interface to make sure that all elements are legible and have good contrast.
Please note that for some website themes the automatic mechanism may detect colors not ideally.
We recommend checking how colors were detected.
Please note that if Ecwid widgets are embedded into an iframe, the automatic mechanism will not work. In
this case additional actions are required, please get in touch with Ecwid Bizdev team for more information
on this.
In cases when the automatic mechanism cannot be used, please use the manual mechanism:
<div><script type="text/javascript">
window.ec ={
config:{
chameleon:{
'color-link': '#ffffff' ,
'color-button': '#00ff00',
'color-foreground': '#a1d3de' ,
//Set widget background transparency through alpha channel
'color-background': 'rgba(29,29,29,0)' ,
'color-price': '#df0739'
}
}
}
Ecwid provides Developer API http://api.ecwid.com/ that can access and manipulate data in
Ecwid stores.
If certain permissions are granted partner can access Developer API on behalf of customers.
This is useful for building various types of integrations with third party products, consolidating
customer data, building reports etc.
To access Developer API for a store it is necessary to retrieve access token that is unique for
every store. Normally receiving access token requires manual permissions granting by customer
as described here http://api.ecwid.com/#get-access-token, however for Ecwid partners there is
an alternative flow that allows generating access token without explicit confirmation from
customer.
Before accessing the Developer API, you must ensure that this functionally is set and enabled
for your partner account. You will need the following access credentials that should be provided
to you by Ecwid: client_id and client_secret. If you do not have this data please get in touch
with Ecwid representative.
To receive token for online store make POST request to the following endpoint:
https://my.ecwid.com/api/oauth/token/{ownerid} and send the following parameters:
{ownerid} in the endpoint path should be replaced with the Store ID number.
Please make sure that the correct domain my.ecwid.com is used to make POST request!
Ecwid responds with a JSON-formatted data containing the access token and additional
information. Please refer to http://api.ecwid.com/#get-access-token STEP 3 to get information
about format of response.
Important: an access token does not expire. So you will need to retrieve the token only once per
store and then use it as many times as you need. In other words, you should save the token in
your system and use it for all API calls instead of generating it every time you access the store
over API.
After receiving access token partner should use it to access Developer API as described in the
documentation http://api.ecwid.com
POST:
https://app.ecwid.com/api/v3/stores?appClientId={appClientId}&appSecretKey={appSecretKey}
&returnApiToken={true/false}
Parameters:
There are 2 mandatory parameters that you need to specify during account creation.
email string Store owner’s email
name string Store owner’s name
Set returnApiToken to true to include token into API response. When store is successfully
created, API will return StoreID (id) of newly created store and API token that should be saved
and used later for API calls for this store.
If you do not yet have appClientId and appSecretKey please contact Ecwid representative at
[email protected] and we will provide you with necessary credentials.
When creating new store you can send multiple optional parameters to pre-configure the store.
Please refer to this documentation for details:
https://lamps.ecwid.com/~rick/web/apiDocs/api_docs.htm#stores
If you need to check if there is a store registered with the specified email, please use the
following GET request:
GET:
https://app.ecwid.com/api/v3/stores?appClientId={appClientId}&appSecretKey={appSecretKey}
&email={email}
If 404 error returns that means that store with given email is not found, so you can create a
store with that email.
Use the following endpoint to display Ecwid control panel and automatically log in customer into
it:
my.{domain}/api/v3/{ownerId}/sso?token={token}×tamp={timestamp}&signature={signature
}
Parameters:
● domain - if your instance of Ecwid is located on custom domain please insert it here.
Otherwise domain should be ecwid.com
● ownerId - unique numeric identifier of the store. Also known as StoreID
● token - ApiToken that was generated during store creation. Also could be received via
oAuth endpoint or via Partner API
● timestamp - UNIX timestamp for current date and time e.g. 1492688357
● signature - is sha256 hash from concatenation of ownerid, token, timestamp and
app_secret without spaces between them:
sha256(ownerid+token+timestamp+app_secret). Signature should be generated without
sha256 secret key. Please generate the signature in lowercase (mandatory!)
● place, inline, logout_url, upgrade_url,
send_postmessage_on_upgrade_button_click - see parameter description in Single
sign-on (SSO) using token mechanism
● hide_visit_storefront_menu=true - (optional) hides the Visit storefront link
http://take.ms/ztmFq
● hide_help_menu=true - (optional) hides the Help menu http://take.ms/lhoJD . The Help
menu is usually hidden for White-label partners.
● hide_profile_menu=true - (optional) hides the Profile menu (round icon with pop-up
menu) http://take.ms/PuAbJ
● hide_profile_header=true - (optional) hides all three elements: Visit storefront, Help
menu, Profile menu.
● hide_page_header=true - (optional) hides pages’ headers (text).
● hide_footer=true - (optional) hides the footer.
● hide_back_button=true - (optional) hides the Back button.
● hide_dashboard_background_image=true - (optional) hides the background image in
the new dashboard and replaces it with grey background. See screenshots:
The new dashboard in default mode - https://d.pr/free/i/VyBe8e.
The new dashboard with hidden background image - https://d.pr/free/i/yPwsNl.
● hide_staff_accounts_header_menu=true - (optional) hides “My stores” link in the
dashboard header https://d.pr/free/i/NmE3o7. “My stores” link allows opening admin
panel of stores where a user is logged in when using the Staff accounts feature.
● hide_vertical_navigation_menu - (optional) - hides main product navigation menu.
This is useful when partner wants to implement navigation menu in host application
outside iframe. Possible values: false, true. Ecwid will send post message
navigationMenuUpdated after initial load of control panel and each time when menu is
changed. Host application where Ecwid is embedded should listen for this message and
use its data to build menu.
● session_tag - (optional) arbitrary string that identifies a session. Used for SSO session
invalidation (logging out customer).
{
'action': 'navigationMenuUpdated',
'data': {
navigationMenuItems: [
{
'title': 'Catalog',
'path': 'products',
'items': {
{
'title': 'Products',
'path': 'products'
},
{
'title': 'Categories',
'path': 'category:id=0&mode=edit'
},
{
'title': 'Product Types',
'path': 'product-classes'
}
}
},
{
'title': 'Sales',
'path': 'orders'
...
},
...
]
}
'height': 1200
}
If you need to use external menu outside the iframe you can use the following code to open
necessary page in iframe without reloading it:
You can populate "place" variable with necessary target e.g. orders, products, etc
If authorization is successful then customer will be redirected to control panel otherwise 403
error will be returned.
Use this call to invalidate the SSO session (log out customer).
When you log in a user via APIv3 SSO, make sure that you are sending an optional session_tag
string parameter.
When you need to log out a user, please do POST request to
https://app.ecwid.com/api/v3/{storeId}/sso-logout?token=<YOUR-TOKEN> .
Use this JSON as its body:
{
"sessionTag": "SESSION-TAG-VALUE"
}
Extensions list:
● Managing list of enabled payment processors
● Managing storeURL
Setting values in the store profile
As a partner, you can set additional parameters using Product API that are not available to
regular users.
To modify store profile you should use PUT HTTP request to the following endpoint URL:
http://app.ecwid.com/api/v1/<ownerId>/profile?secure_auth_key=<Your partner API key>
In the body of request you should add JSON document, which may contain the following fields:
● enabledOnlineProcessors - enabled online payment processors for given ownerId.
Possible values are:
○ [] - allow all processors;
○ [“NONE”] - forbid all online payment processors;
○ [“processor1”, “processor2”, “processor3”] - allow all offline payment processors
and all listed online payment processors.
It is possible to turn on payment processors, that will be supported in future. For
example, you can enable “amex” for all your clients in advance and as soon as it will be
released, this payment will appear in all stores automatically.
● storeUrl - set store URL. Possible values are:
○ null - do not change store URL;
○ “” - reset store URL value;
○ new value of store URL. Must be valid URL beginning with “http://” or “https://”.
Response:
If storeUrl is not valid URL or does not start with “http://” or “https://”, server will respond with
error 400 Bad Request.
If JSON with fields enableOnlineProcessors or storeUrl sent with customer API key, server will
respond with error 403 Forbidden.
You can also get information about extended fields of store profile us API. To do so make GET
HTTP request to the following endpoint URL:
http://app.ecwid.com/api/v1/<ownerId>/profile?secure_auth_key=<Your partner API key>
Among all default fields, additional field enabledOnlineProcessors will be listed. Possible
values are:
● [] - allow all processors;
● [“NONE”] - forbid all online payment processors;
● [“processor1”, “processor2”, “processor3”] - allow all offline payment processors and all
listed online payment processors.
Upon requesting Product API with customer API key or anonymously, field
enabledOnlineProcessors will not be listed.
By default Control panel will automatically switch to the correct language depending on
customer language setting in the web browser. However you can override this behaviour and
display control panel in certain language. Use lang parameter to when when accessing control
panel:
e.g. https://my.ecwid.com/cp/?lang=es
Russian: ru
French: fr
German: de
Italian: it
Dutch: nl
Spanish: es
Brazilian Portuguese: pt_BR
Indonesian: id
Czech: cs
Hungarian: hu
Turkish: tr
Bulgarian: bg
Norwegian: no
Swedish: sv
Danish: da
Polish: pl
Finnish: fi
Billing Rules
To better understand Ecwid will bill you for the services, please refer to this document.
Ecwid allows to create new stores subscribed to the trial version for the paid plan, if this
functionality was enabled during partner creation. It is possible to define number of trial days for
paid plan and the plan itself for which trial subscription will be available.
Note: Number of trial days and the trial subscription availability are defined by Ecwid and can’t
be managed through Partner API.
What is next?
When the request on new trial account creation is received, Ecwid creates new account and
subscribes it to the paid plan with the expiration date calculated as:
date of subscription + number of trial days
Our internal script will check all trial subscriptions periodically and switch them to “Live” mode
automatically, when trial period is over. All trial subscriptions are converted to Live paid
subscription automatically and you will be billed for them accordingly.
Define upgrade URLs
There are lot of upgrade URLs in Ecwid interface they trigger upgrades when customer want to
use certain functionality that is not available for the current plan. Normally they just lead to
Ecwid plans page but partner can redefine them and point to alternative location e.g. to
partner’s billing page where customer can manage their subscription.
This URL can be setup globally for all stores during initial deployment just specify it in partner
questionnaire. However if you have few sub resellers with individual billing systems that you can
define Upgrade URL on per store basis specifying URL in template XML for the store. Below is
an example of defining URL in template XML:
<owner>
<source>test_account</source>
<customUpgradeUrl>http://www.example.com?plan={plan}&storeid={ownerid}&AnyOtherPa
rameters</customUpgradeUrl>
...
</owner>
Below are the details on how to do that for new and existing customers.
Request:
POST
https://my.ecwid.com/resellerapi/v1/register?register=y&returnProfileId=true
Response:
<?xml version="1.0" encoding="UTF-8"?>
<store>
<ownerid>12345</ownerid>
<profileid>p987654321</profileid>
</store>
Partner specifies the profile ID when creating new Ecwid stores for the existing
user
If the same user requests to create another Ecwid store (e.g. to add a store to their another
site), the partner should pass the existing profile ID in the request query to the Ecwid Partner
API. This will assign a new store to the same profile ID in Ecwid.
Request:
POST https://my.ecwid.com/resellerapi/v1/register?register=y&profile_id=p98765
Partner passes the profile ID parameter in SSO request when logging in the user
to an Ecwid control panel
When opening the Ecwid control panel using the Ecwid SSO API, partner should pass the
profile_id query parameter to make Ecwid log that user into the specific profile ID.
Request:
GET https://my.ecwid.com/cp/partner-login?ownerid=[ID]&profile_id=p98765
That's it. Several logins to Ecwid control panel with the same profile ID can work in the same
browser without interrupting each other.
Example
Let's say a customer creates several sites in the partner product (e.g. sitebuilder) and adds a
new store to each site.
1) [email protected] requests to add a store to their site A
- The partner checks if the user already has an Ecwid profile ID assigned. This is a new
customer, so let's say there is no Ecwid profile ID on file.
- The partner uses the Ecwid Partner API to register a new store and specifies
'returnProfileId=true' in the request
- Ecwid returns the store ID 123 and the profile ID p98765 for the new store
- The partner saves the Ecwid profile ID in the user record to keep the link between
[email protected] and Ecwid profile ID p98765 in the system.
2) [email protected] requests to add a store to their another site — site B
- The partner checks if the user already has an Ecwid profile ID assigned. This time, the
Ecwid profile ID is there — it's p98765.
- The partner uses the Ecwid Partner API to register a new store and specifies
'profile_id=p98765 in the request
- Ecwid creates a new store and assigns it to the existing profile instead of generating a
new profile. The response specifies the new store ID 456. Now, two stores in Ecwid are
assigned to that profiel: store ID 123 and store ID 456.
3) [email protected] opens store control panels in the partner UI.
- The user manages the site A in one browser tab, and the site B in another browser tab
- To display the Ecwid control panel, the partner uses the Ecwid SSO API and passes the
profile_id parameter in request.
- The control panel A and the control panel B work simultaneously in different browser
tabs.
How to make it work for the existing users
Partner's existing Ecwid stores were registered before the above mentioned API became
available. All of those stores have different profile IDs assigned, even the stores of the same
customer are separate. To make the new approach working for the old users, the partner needs
to re-assign profile ID for those existing users who run several Ecwid stores.
Partner finds Ecwid stores belonging to the user and their profile IDs
Partner should check the Ecwid stores belonging to a user and get their profile IDs. This can be
done via the /status endpoint of the Partner API. The profile ID field will present in the XML
response.
Request:
GET https://my.ecwid.com/resellerapi/v1/status
Response (XML):
…
<profileid>p987654321</profileid>
…
Partner assigns the same profile ID for all Ecwid stores belonging to the user
Now the partner has a list of stores and profile IDs assigned to them. Partner should choose any
of those profile IDs (e.g. the first one) and assign it to all stores of that customer, so that all
stores have the same profile ID.
To change the profile ID of the store, the Ecwid's Partner API /change-store-profile endpoint can
be used. It requires the following parameters:
- key: the Partner reseller key
- ownerid: the store ID
- src_profile: the old profile ID
- dst_profile: the new profile ID
The partner will get 200 OK in response if the profile ID has re-assigned.
Request:
POST
https://my.ecwid.com/resellerapi/v1/change-store-profile?ownerid=123&key=abc123
&src_profile=p98765&dst_profile=p55555
When it's done for all stores of the user, the new profile-based SSO API can be used as
explained above.
Note on security
When the same profile ID is specified for several stores, it tells Ecwid that the user associated
with that profile ID can manage all of those stores without extra login/password. So, partners
should be careful when assigning profile ID to avoid unintentionally giving a wrong user access
to the store data.