Update pricing configuration
          Last updated: 15-Jan-2021
        
        
    Rate this article:
    
    
  
        Overview
Use the updatePricingConfiguration method to update/edit an existing pricing configuration.
Requirements
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).
 
Parameters
| Parameters | Type/Description | 
|---|---|
| 
 sessionID  | 
 Required (string)  | 
| 
 
  | 
 Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout 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.  | 
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 );
$existingPricingConfig[1]->Prices->Renewal[0]->Amount = 10;
$existingPricingConfig[1]->Prices->Renewal[0]->Currency = 'USD';
$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));
?>
Related articles
    Rate this article: