> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 Subscribe 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, `Product`s are usually created using the Subscribe 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 Subscribe.

## 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 [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | One of the following: - *Error-description*. - `Subscribe encountered a general error while mapping the input Product object to the Subscribe 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();
}
```

**Parent topic:**[Product Methods](../topics/Product_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.