Update price options

Use the updatePriceOptionGroup method to update/edit an existing price options group you configured for your account. Price options intervals cannot overlap.

Request 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 a new price option group for your account.

Response sample

bool(true)

Request sample

<?php

require ('PATH_TO_AUTH');

$SearchOptions = new stdClass ();
$SearchOptions->Name = 'New Users from API';
$SearchOptions->Types = array('INTERVAL', 'RADIO'); //RADIO, CHECKBOX, INTERVAL, COMBO

$SearchOptions->Pagination = new stdClass ();
$SearchOptions->Pagination->Limit = 10;
$SearchOptions->Pagination->Page = 1;

try {
    $existentPriceOptions = $client->searchPriceOptionGroups($sessionID, $SearchOptions);
}

catch (SoapFault $e) {
    echo "existentPriceOptions: " . $e->getMessage();
    exit;
}

var_dump ($existentPriceOptions);

$updatedPriceOptions = $existentPriceOptions->Items[0]; //assigning pricing option into a new variable
$updatedPriceOptions->Translations[0]->Name = 'New Users from API3';
$updatedPriceOptions->Translations[0]->Language = 'EN';

echo ($updatedPriceOptions->Name);

try {
    $NewPriceOptionGroup = $client->updatePriceOptionGroup($sessionID, $updatedPriceOptions);
}

catch (SoapFault $e) {
    echo "NewPriceOptionGroup: " . $e->getMessage();
    exit;
}

var_dump("NewPriceOptionGroup", $NewPriceOptionGroup);

?>

Last updated

Was this helpful?