Skip to main content
Vindicia Knowledge Center

Product.update

Product.update

Product.update

The update method creates or updates a Product object.

To create a Product object, initialize the object and set the values for its data members, as appropriate, and then call the update() method to store the changes. During the process, do not set a value for VID because CashBox automatically generates that when you call update(). When updating an existing Product object, identify it with its VID or your product ID (merchantProductId).

Because products are typically stable company offerings, and are updated or created only rarely, Products are usually created using the CashBox Portal, rather than the API.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

product: the Product object to create or update. Identify this object using either its VID or your product ID (merchantProductId).

duplicateBehavior: an enumerated string that is currently not supported by CashBox.

Output

return: an object of type Return that indicates the success or failure of the call.

product: the Product object that was created or updated.

created: a Boolean flag that, if set to true, indicates that this method has created a new Product object. A false setting indicates that update has updated an existing Product object.

Returns

In addition to those listed in Standard Return Codes, this call returns:

Return Code

Return String

400

One of the following:

  • Error-description.
  • CashBox encountered a general error while mapping the input Product object to the CashBox database.
  • Unable to save product: error-description.
  • Unable to retrieve saved product: error-description.

Example

// to create a new product object

$product = new Product();

// Identify the product by your unique identifier, etc.

$product->setMerchantProductId('gold12345');
$product->setStatus('Active');
$product->setDescription('Premium Video Access');

$meId = new MerchantEntitlementId();
$meId->setId('PremiumVideoAccess2010');
$meId->setDescription('Premium video access privilege for 2010');

$product->setMerchantEntitlementIds(array($meId));

$response = $product->update(DuplicateBehavior::SucceedIgnore);

if($response['returnCode'] == 200 && $response['created']) {

$createdProduct = $response['data']->product;
print "Created product with VID " . $createdProduct->getVID();

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top