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

# Account.update

The `update` method creates an `Account` object, or updates an existing one. Use the `update` method when a new customer record is created.

To create an `Account` object, initialize it and set the values for its data members as appropriate, and then call the `update` method to store the changes. When creating a new `Account` object, do not set a value for `VID`; Subscribe will automatically generate a VID for the object when you call `update`. When updating an existing `Account` object, identify it with its VID or your account ID (`merchantAccountId`).

**Note:** Do not call `update()` to add or change a payment method for `Account`. Call `Account.updatePaymentMethod()` instead. (See the [Account.updatePaymentMethod](Account_updatePaymentMet) method.)

When you update an Account, Subscribe edits the existing Payment Method.

* If the `merchantPaymentMethod` of an existing Payment Method is passed, then that Payment Method is edited. If `replaceOnAllAutoBills` is `false`, this edit is applied to all AutoBills using that Payment Method, and no other.
* If a new `merchantPaymentMethodId` is passed, then a new Payment Method is created. If `replaceOnallAutoBills` is `false`, then the new Payment Method will not be applied to any autoBills. If it is `true`, it will be applied to all.

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

*account*: the `Account` object to create or update. Use the `merchantAccountId` or `VID` to identify the object.

## Output

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

*account*: the `Account` object you created or updated.

*created*: a Boolean flag that, if set to `true`, indicates that `update` has created a new `Account` object. A `false` setting means that `update` has updated an existing `Account` 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: - `Data validation error. Failed to create Payment-Type-Specific Payment Record: Credit Card conversion failed: Credit Card failed Luhn check.` - `Failed to save account.` - `This Credit Card already exists—Policy Violation" (eradicate the newly created but failed one or ensure it is set INACTIVE).` You receive this error message when you have the Credit\_Card\_Constraints merchant option enabled on your site. This message means that someone is attempting to use a credit card that is already being used as the payment method on an existing account. This is not allowed. |

## Example

```

// Create a new Account object
$account = new Account();

// Provide basic account information
$account->setName('Somebody Q. Customer'); // Customer name
$account->setMerchantAccountId('IN9430-8421'); // Unique customer id

// To create address information, create an address object
$address = new Address();
$address->setAddr1('123 Main Street');
$address->setAddr2('Apt. 4');
$address->setCity('San Carlos');
$address->setDistrict('CA');
$address->setPostalCode('94070');
$address->setCountry('US');
$address->setPhone('123-456-7890');

// Associate the Address object with the account

$account->setShippingAddress($address);

// Emails
$account->setEmailAddress('John.Doe@gmail.com');
$account->setEmailTypePreference('html');
$account->setWarnBeforeAutoBilling(true);

// Okay, basic information is entered, so save the account
$response = $account->update();

// Check to see that the account was created
if($response['returnCode'] == 200) {
   // You can save the VID (Vindicia ID) for later use
   $accountVid = $account->getVid();
}
```

**Parent topic:**[Account Methods](../topics/Account_Methods)


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