Integrating with Onport
You can quickly and easily integrate Elastic Path Commerce Cloud with Onport using the Integrations Hub in Commerce Manager. Onport supports marketplace and/or dropship vendor models. Integrating Onport with Elastic Path Commerce Cloud means you can enable support for marketplace and dropship vendor models in Elastic Path Commerce Cloud. The Onport Integration supports the following features.
Product changes in Onport causes webhook events to be generated to change product data in Elastic Path Commerce Cloud.
Inventory changes in Onport causes webhook events to be generated that increment or decrement inventory in Elastic Path Commerce Cloud.
Order changes in Elastic Path Commerce Cloud like creating, updating, fulfilling and so on, causes webhook events to be generated that cause orders to be created, updated, fulfilled and so on, in Onport. The following Elastic Path Commerce Cloud event types can be used to generate webhook events.
order.created
order.updated
order.fulfilled
order.paid
order.authorized
Split Orders orders generated in Elastic Path Commerce Cloud causes webhook events to be generated in Onport that allow Onport to split an order based on vendors.
For more information, watch a video.
Synchonizing Onport Product Data With Elastic Path Commerce Cloud Product Data
As part of the Onport Integration, changes in product data in Onport automatically updates product data in Elastic Path Commerce Cloud. This is achieved using the Onport Integration Product Template.
In Elastic Path Commerce Cloud, create your templates. Any Onport product attributes should have corresponding attributes in your Elastic Path Commerce Cloud templates.
When configuring the Onport Integration in Integrations Hub, from Template page, click Edit underneath Product Template.
Update the Product Template to map the Elastic Path Commerce Cloud product attributes to the Onport product attributes. For example, suppose you want to save Onport variant id, vendor id and vendor name in Elastic Path Commerce Cloud, along with the product clothing material, if that exists.
The example below shows how this should look in the Product Template.
"templates": {
"products(onport-reference)": {
"type": "entry",
"onport_variant_id": "{{variant.id}}",
"onport_vendor_id": "{{variant.vendorId}}",
"onport_vendor_name": "{{vendor.name}}"
}
},
"products(clothing)": {
"type": "entry",
{% for customField in customFieldVariants %}
{% if customField.custom_field.name == "Material" %}
"material": "{{customField.value}}"
{% endif %}
{% endfor %}
}
}
Synchronizing Elastic Path Commerce Cloud Order Data With Onport Order Data
As part of the Onport Integration, changes in orders in Elastic Path Commerce Cloud automatically updates order data in Onport. Suppose you are adding shipping charges to an order and the shipping sku is STANDARD-DELIVERY. You must change the Order Template so that this is available in Onport.
- You must exclude the shipping sku from the line item so that it does not appear as part of the product in Onport.
- When configuring the Onport Integration in Integrations Hub, from Template page, click Edit underneath Product Template. The example below shows how this should look in the Product Template.
"lineItems": [
{% assign exists = false %}
{% for item in payload.included.items %}
{% if item.sku != "STANDARD-DELIVERY" and item.meta.display_price.with_tax.unit.amount >= 0 %}
{% if exists %},{% endif %}
{% assign exists = true %}
{
"externalId": "{{item.id}}",
"name": "{{item.name}}",
"quantity": {{item.quantity}},
"price": {{item.meta.display_price.with_tax.unit.amount | divided_by: 100}},
"taxable": false,
"variant": {
"sku": "{{item.sku}}",
"externalId": "{{item.sku}}"
}
}
{% endif %}
{% endfor %}
]
- From Template page, click Edit underneath Order Template. The example below shows how this should look in the Order Template.
"options": {
"findOrCreateChannelVariant": true
}
{% for item in payload.included.items %}
{% if item.sku == "STANDARD-DELIVERY" and item.meta.display_price.with_tax.unit.amount >= 0 %}
,"shipping": [
{
"code": "shipping-fee",
"name": "Shipping Fee",
"serviceLevel": "shpping-service-level",
"price": {{item.meta.display_price.with_tax.unit.amount | divided_by: 100}}
}
]
{% endif %}
{% endfor %}
Prerequisites
You must have completed the following tasks in Onport before configuring the integration in Elastic Path Commerce Cloud.
Create an Onport Channel ID
You must provide a custom Onport Channel ID when you are configuring the Onport Integration in Integrations Hub. See Onport Dev Docs.
- Login to Onport.
- Go to Integrations.
- Click Custom Channel to create a new custom channel. The Channel ID forms part of the custom channel URL, once the custom channel is created.
Retrieve the Onport Custom Channel ID
Once you have created a custom channel ID, you need to retrieve it using GET /custom-channels/<id>.json
from Onport Custom Channel API where id is the channel ID that forms part of the channel URL that you created above. An example response is shown below.
{
"id": 143,
"companyId": "3001",
"channelId": 5365,
"name": "Elastic Path Commerce Cloud",
"resourceLocation": "null"
}
Collecting Your Setup Information
Before you begin configuring your Onport integration in Commerce Manager, you need to collect the necessary setup information from Onport and Commerce Manager.
Collecting Onport Setup Information
Collect the following setup information from Onport.
Option | Description |
---|---|
API Base URL | Your Onport API Base URL. Default value is https://api.jetti.io/api . |
API Key | Your Onport API Key. |
Collecting Commerce Manager Setup Information
Collect the following Elastic Path Commerce Cloud API keys. You can find this information in SYSTEM > Application Keys in Commerce Manager when logged in as a user with Seller Admin privileges.
Elastic Path Commerce Cloud API Key | Description |
---|---|
API Base URL | Your Elastic Path Commerce Cloud API Base URL. |
Client ID | Your Elastic Path Commerce Cloud Client ID. |
Client Secret | Your Elastic Path Commerce Cloud Client Secret. |
When integrating with third-party providers, we recommend you use the closest region in the third-party service to reduce latency as much as possible. See Regions and URLs table.
Configuring the Onport Integration
Once you have:
You are ready to configure the Onport integration in Integrations Hub.
In Commerce Manager, go to COMPOSER > Integrations Hub.
Under Order Management, Marketplace and Inventory Integrations, click Onport Integration. The Onport integration guides you through the steps you need to follow to complete the integration.
Click Next. The Trigger details consist of some details about the Onport integration.
Click Next. The Connection page is displayed.
Complete the information in the Connection page.
- Client-ID - Your Elastic Path Commerce Cloud Client ID.
- Client-Secret - Your Elastic Path Commerce Cloud Client Secret.
- Token URL - Your Elastic Path Commerce Cloud API Token URL.
Click Connect to make sure that the authentication is completed successfully.
Complete the Onport Connection credentials.
- API Base URL - Your Onport API Base URL. Default value is
https://api.jetti.io/api
. - API Key - Your Onport API Key.
- API Base URL - Your Onport API Base URL. Default value is
In Onport Channel ID, provide your Onport Channel ID. See Create an Onport Channel ID.
Click Next. The Webhook Setup page is displayed. From this page, decide which webhooks you want to set-up, depending on your requirements. The Onport Integration automatically creates the webhooks, once you have finished configuring the integration.
Do not change any API keys for the webhooks. The webhooks are authorized using the
configuration.secret_key
value in the request body. Configuring an API key directly on a webhook results in a non-functional integration.(Optional) If you want orders in Elastic Path Commerce Cloud to be integrated with Onport, turn on the Enable Order Webhook toggle.
(Optional) If you want inventory changes in Onport to increment or decrement inventory in Elastic Path Commerce Cloud, turn on the Enable Inventory Webhook toggle.
(Optional) If you want product changes in Onport to change product data in Elastic Path Commerce Cloud, turn on the Enable Product Webhook toggle.
If you have turned on the Enable Order Webhook toggle, you need to specify the order events that you want to generate webhook events for. In Order Events, select the events from the Value list. Click +Add value to add more events. You can select one or all of the following:
order.created
order.updated
order.fulfilled
order.paid
order.authorized
Click Next. The Templates configuration page is displayed.
Click Edit for the request template you want to edit. See Synchonizing Onport Product Data With Elastic Path Commerce Cloud Product Data and Synchronizing Elastic Path Commerce Cloud Order Data With Onport Order Data.
Click Finish. Your integration is enabled.
Using Onport Integration
To change any configuration details in your Onport integration, open your Onport Integration and go to Summary > Reconfigure.
In addition, from Summary, you can view, pause or delete your Onport integration.
If there is an update to the Elastic Path Commerce Cloud Onport integration, a message is displayed in Summary. Click Update to update your integration. You are guided through the steps to configure your integration.
Troubleshooting the Onport Integration
You can debug any issues in Executions. Click an execution to see the execution details. The Logs shows the output and any errors or warnings.
From Step Outputs, you can select a step to see its output. You can retry an individual step.