Update pricing configuration
Last updated: 13-Jul-2017
Rate this article:
Overview
Use the updatePricingConfiguration method to update/edit an existing pricing configuration.
Parameters
Parameters | Type/Description |
---|---|
Parameters |
Type/Description |
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Required (object) |
|
|
Use this object to update/edit an existing pricing configuration for your account. |
ProductCode |
Required (string) |
|
The unique product code that you control not the system-generated product identifier. |
You cannot modify:
- The pricing configuration CODE.
- The PricingSchema from DYNAMIC to FLAT or vice versa.
- The intervals of an existing pricing configuration (MinQuantity and MaxQuantity).
Response
bool(true)
Request
<?php
require ('PATH_TO_AUTH');
$ProductCode = 'YOUR_PRODUCT_CODE';
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getPricingConfigurations',
'params' => array($sessionID, $ProductCode)
);
$existingPricingConfig = callRPC((Object)$jsonRpcRequest, $host);
var_dump ($existingPricingConfig );
die;
$existingPricingConfig[1]->Prices->Regular[0]->Currency = 'USD';
$existingPricingConfig[1]->Prices->Regular[0]->Amount = 99;
$newPriceConfig = $existingPricingConfig[1];
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePricingConfiguration',
'params' => array($sessionID, $newPriceConfig, $ProductCode) //Use product ID and not product code for API versions smaller than 2.5
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));
?>
Rate this article: