Retrieve product price
Overview
Get the price for a product in a new purchase scenario, based on the product ID, the pricing list it's assigned to and specific pricing options.
Requirements
This method requires you to set a specific partner using setPartner.
Parameters
Parameter | Type/Description |
---|---|
sessionID | Required (string) |
Session identifier, which is the output of the Login method. An exception will be thrown if the values are incorrect. | |
productId | Required (string) |
The unique identifier of the product from your system. | |
pricingListCode | Required (string) |
The unique identifier of the pricing list. | |
priceOptions | Optional (StringArray) |
Array of pricing option codes. These identifiers mark the individual options inside pricing options configuration groups. Can be NULL. |
Response
Parameter | Type/Description |
---|---|
UnitPrice | Object |
UnitPrice object. |
Request
<?php require ('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication require ('PATH_TO_SET_PARTNER'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner $productId = 'YOUR_PRODUCT_ID'; $pricingListCode = 'YOUR_PRICING_LIST_CODE'; $priceOptions = array( 'PRICE_OPTION_CODE_1', 'PRICE_OPTION_CODE_2' ); $jsonRpcRequest = array ( 'jsonrpc' => '2.0', 'id' => $i++, 'method' => 'getProductPrice', 'params' => array($sessionID, $productId, $pricingListCode, $priceOptions) ); var_dump (callRPC((Object)$jsonRpcRequest, $host));
Errors
Error | Description |
---|---|
INVALID_PARTNER |
No partner is set. |
PRODUCT_ERROR |
Invalid product ID. |
PARTNER_PRICING_LISTS_NOT_FOUND |
There are no pricing lists with the provided code. |
PRODUCT_NOT_FOUND |
There is no active product with the provided ID in the given pricing list. |