Update additional fields
Last updated: 26-Jul-2019
Rate this article:
Overview
Use the updateAdditionalField method to update additional fields for your account.
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. |
Object |
|
|
Additional field object. |
Response
bool(true)
Request
<?php
require ('PATH_TO_AUTH');
$AdditionalField = new stdClass();
$AdditionalField->Label = 'Do you agree with the new newsletter policy 2015?';
$AdditionalField->Type = 'LISTBOX';
$AdditionalField->Code = 'NewsletterPolicy1234576';
$AdditionalField->ApplyTo = 'ORDER';
$AdditionalField->Values = array();
$AdditionalField->Values[0] = 'YES';
$AdditionalField->Values[1] = 'NO';
$AdditionalField->ValidationRule = null;
$AdditionalField->Translations = array();
$AdditionalField->Translations[0] = new stdClass();
$AdditionalField->Translations[0]->Label = "Êtes-vous d'accord avec la politique de la newsletter?";
$AdditionalField->Translations[0]->Values = array();
$AdditionalField->Translations[0]->Values[0] = 'Oui';
$AdditionalField->Translations[0]->Values[1] = 'Non';
$AdditionalField->Translations[0]->Language = 'fr';
$AdditionalField->Translations[1] = new stdClass();
$AdditionalField->Translations[1]->Label = 'Haben Sie mit dem Newsletter Politik zu?';
$AdditionalField->Translations[1]->Values = array();
$AdditionalField->Translations[1]->Values[0] = 'Ja';
$AdditionalField->Translations[1]->Values[1] = 'Nein';
$AdditionalField->Translations[1]->Language = 'de';
$fieldCode = 'ERROR_SAVING';
$jsonRpcRequest = array(
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updateAdditionalField',
'params' => array(
$sessionID,
$fieldCode,
$AdditionalField
)
);
var_dump(callRPC((Object) $jsonRpcRequest, $host));
?>
Related articles
Rate this article: