Skip to main content

Commerce Price Import

The Commerce Price Import is a utility in the Integrations Hub in Commerce Manager that enables you to import Commerce price data from one Commerce store to another. The Commerce Price Import utility can import:

  • Price data files of any size.
  • Tier and sale pricing associated with prices.
caution

The Price Import integration does not support bundles.

An example of how price data is imported using a Price Import integration is described below.

  1. Create a JSON file with the price data you want to import. You can have more than one JSON file, depending on your requirements. See Price Import Integration File Format.

  2. Configure a Price Import integration in the store where you want to import the price data. This creates the webhooks that consumes the message and JSON files when you send the API request to import the price data.

  3. In Postman, run POST {{webhook-url}} request. As part of the request, you must supply the Gzip file URLs for the JSON files you want to process as part of the import. See Using Price Import Integration Files.

    • The Price Import integration processes your Gzip files.
    • The prices are imported to the store.

Price Import Integration File Format

The data that you provide to the Price Import integration must conform to JSON Lines text format and conform to the following model. The price JSON schema file can be used to validate the format of your price objects.

NameTypeDescription
skustringThe unique stock keeping unit of the product.
priceBookNamestringThe name of the pricebook.

The Prices object

Each product SKU can have prices in multiple currencies.

AttributeTypeDescription
currencystringThe three-letter ISO code for the currency associated with this price.
amountintegerThe price in the lowest denomination for the specified currency.
tax_inclusivebooleanWhether this price includes tax. Default is false.

The tiers object

Each tier can only have one currency within the same block.

AttributeTypeDescription
tiers: <key>objectThe name of the tier, such as Pencils.
tiers: <key>: minimum_quantityintegerThe minimum quantity defined for the specified price.
tiers: <key>: amountintegerThe price for each quantity.

The sales object

Each sale can only have one sale within the same block.

AttributeTypeDescription
sales: <key>objectThe name of the sale, such as Summer Sale.
sales: <key>: scheduleobjectThe schedule of the sale. Contains an optional valid_from and valid_to parameter for the start and end date of the sale.

Example Price Object

{
"sku": "productSku",
"priceBookName": "priceBookName",
"prices": [
{
"currency": "USD",
"amount": 10000,
"tax_inclusive": false,
"tiers": [
{
"name": "tierName",
"minimum_quantity": 5,
"amount": 90000
}
]
}
],
"sales": [
{
"name": "saleName",
"schedule": {
"valid_from": "2022-05-03T20:47:54.068Z",
"valid_to": "2022-05-28T20:47:57.068Z"
},
"salePrices": [
{
"currency": "USD",
"amount": 80000,
"tax_inclusive": false,
"tiers": [
{
"name": "tierName",
"minimum_quantity": 5,
"amount": 80000
}
]
}
]
}
]
}

Using Price Import Integration Files

To invoke the price import, you must invoke the webhook created when you configure the Price Import integration and supply the Gzip file URLs as part of the payload. See Importing your Price Data. We recommend that URLs are signed with an expiration date. See Sharing objects using presigned URLs.

Body

NameRequiredTypeDescription
gzipFileUrlsRequiredstringThe Gzip file URls for the JSON files you want to import in the format https://{path}/products-price.jsonl.gz where path is the path to your Gzip file. You can specify more than one. We recommend aligning the number of products per file with the pageSize, as processing each page requires rereading the file.
fileIndexOptionalintegerThe zero based index of the gzip file to start with. The default is zero. This is useful to restart processing in case of failure.
PageSizeOptionalintegerThe number of products to process from a given file in a paged manner. The default is 500 and the upper limit depends on the number of custom attributes, files and variations. Tuning may be required to find the optimal page size.
pageOptionalintegerThe number of pages handled during import.

Request Example

{
"gzipFileUrls": [
"https://{path}/product-price.jsonl.gz"
],
"fileIndex": 0,
"pageSize": 1000,
"page": 0
}

Prerequisites

  1. The store where you are importing your price data must already have the pricebooks defined. The Price Import does not create pricebooks as part of the import.
  2. You must have a JSON file configured that defines the price data you want to import. See Price Import Integration File Formats.

Configuring the Price Import Integration

Once you have met the Prerequistes, you are ready to configure the price import integration in Integrations Hub.

  1. In Commerce Manager, go to the store where you want to import price data.

  2. Go to COMPOSER > Integrations Hub.

  3. Under Store Management & Configuration, click Commerce Price Import. The Commerce Price Import integration guides you through the steps you need to follow to complete the integration.

  4. Click Configure. The Trigger details are displayed. URL is the webhook that consumes your Gzip files.

  5. Click Next. The Commerce Configuration page is displayed.

  6. Complete the information in the Commerce Configuration page.

    1. Commerce Connection details.

      • Client-ID - Your Commerce Client ID.

      • Client-Secret - Your Commerce Client Secret.

        You can find this information in SYSTEM > Application Keys in Commerce Manager when logged in as a user with Seller Admin privileges. See Application Keys.

      • Token URL - Your Commerce API Token URL. For example, https://api.motlin.com/oauth/<access_token> (EU) or https://useast.api.elasticpath.com/oauth/<access_token> (US).

      • Keep Alive Flag - Turn on the Keep Alive Flag toggle if you want to specify keep alive intervals for this integration.

      • Keep Alive Interval - Specify keep alive interval for this integration. Default value is 10000.

      • Throttle Interval - Specify throttle interval for this integration. Default value is 125. This supports staying within rate limits.

      • Throttle Limit - Specify throttle request limit interval for this integration. Default value is 3. This supports staying within rate limits.

    2. Click Connect. The Integration Hub uses your cuurent store crededentials to automatically connect you to your store.

    3. Elapsed Execution Time Cutoff is the number of seconds to wait before the node import is stopped, if page processing has halted for any reason. This may need to be increased if the number of nodes being processed for the store is exceptionally large.

    4. Default Page Size is the default page size processed when importing.

    5. Log Level - From Log Level list, select the level of logging.

  7. Click Finish. Your integration is enabled. You must enable a Price Import integration on each store where you want to import your price data.

Importing your Price Data

You can perform the price import using Postman.

  1. Go to a store.
  2. Go to COMPOSER > Integrations Hub.
  3. Under Store Management & Configuration, select Commerce Price Import. You must have configured a Price Import integration before you can import any resources into this store. See Configuring the Price Import Integration.
  4. From Summary > Trigger Details, click Gzip File URL Handler to display the webhook.
  5. Select Copy to Clipboard to copy the URL.
  6. Go to Postman.
  7. Open POST {{gzip-file-url-handler-webhook-url}} where {{gzip-file-url-handler-webhook-url}} is the webhook you copied in step 5.
  8. In Body, add the list of Gzip file URLs for the JSON files you want to import. See Price Import Integration File Format.
  9. Run POST {{gzip-file-url-handler-webhook-url}}.
  10. When the import has finished, if you go to your store, you should see all the resources you just imported.

Troubleshooting the Price Import 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.

Select Retry to initiate an execution again.

Demos