> ## 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.

# Chargeback.update

The `update` method creates or updates a `Chargeback.` object. This method is rarely used, because Vindicia usually creates and updates chargebacks by retrieving them directly from your payment processor, and updating their status during the dispute process.

You may also call `Chargeback.report()` to create one or more chargebacks in the Vindicia database. To create or update a single chargeback and immediately discover if the call succeeds or fails, call `update()`. The `report()` method processes data asynchronously, which means that even if you successfully submit a chargeback with a batch `report()` call but an error occurs during processing, you are not immediately aware of the error.

To create a `Chargeback` object, initialize the object and set the values for its data members, as appropriate, and then call `update()` to store the changes. When creating a new `Chargeback` object, do not set a value for `VID` because Subscribe automatically generates that when you call `update()`. When updating an existing `Chargeback` object, identify it with its VID.

## 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.

*chargeback*: the `Chargeback` object to create or update. To update an object, identify it with its VID.

## Output

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

*chargeback*: the `Chargeback` object that was created or updated.

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

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `200` | One of the following: - `OK.` - `Chargeback object was unchanged.` |
| `400` | One of the following: - `Failed to save chargeback.` - `Error saving chargeback disposition log entry: *error-description*.` |

## Example

```

// create a chargeback object and populate it with data

$cb = new Chargeback();
$cb->setMerchantTransactionId("TX-2324");
$cb->setAmount(34.99);
$cb->setReferenceNumber("PTECH-42123");
$cb->setProcessorReceivedTimestamp('2009-11-11T22:34:32.265Z');

// Set other chargeback object fields here as available

...

$ret = $cb->update();
if ($ret['returnCode'] == 200 && ($ret['created']) {
   log("Chargeback created with VID" 
      . $ret['chargeback']->getVID() .
      " with Vindicia successfully at " . time() );
}
```

**Parent topic:**[Chargeback Methods](../topics/Chargeback_Methods)


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