Pricing webhook
As with inventory, pricing can also be synced in realtime via webhooks. First, you'll need to configure the location of the endpoint under your custom channel settings. This will typically be the location of a route in your custom store. Or, the location of a serverless function designed in process parallel requests at scale.
Once setup, Onport will push out pricing updates in real time as prices change. For example, Onport will send a request to the endpoint if the pricing of an item changes within an inventory feed. The webhook sends a payload of data via a POST
request containing details of the price (including the compare at price), the variant and the channel variant.
{"channelVariant": {"id": 9,"companyId": 11,"variantId": 10,"channelId": 21,"externalId": "123","externalGroupId": null,"externalSku": null,"source": "shopify","hash": null,"parentHash": null,"status": "pending","errorMessage": null,"inventoryUpdate": {"inventoryQuantity": 5},"priceUpdate": null,"publishUpdate": null,"costPriceUpdate": null,"createdAt": "2019-12-16T21:45:12.828Z","updatedAt": "2019-12-16T21:45:13.192Z","channel": {"id": 21,"parentChannel": "custom","priceListId": 11,"name": "Custom","syncPricing": true}},"price": {"price": 10,"compareAtPrice": null,"id": 5,"companyId": 11,"variantId": 10,"priceListId": 11,"updatedAt": "2019-12-16T21:45:13.197Z","createdAt": "2019-12-16T21:45:13.197Z"},"zeroCompareAtPrices": null}
The endpoint should return a 200 response within 3 seconds of the API request. Although this can be extended if needed, we recommend actions on your custom channel are asynchronous. An example setup would typically push the payload of data into a background queue for later processing.