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

# Creating Customer Accounts

When a new customer visits your site to purchase a product or service, establish an account for that customer and store the related information in a database in your system. You can also create a record of customer information in Subscribe to facilitate the financial transactions you later pass to Subscribe for processing.

To establish a new customer account, create an `Account` object, populate it with data, and store that data in the Subscribe database using the `Account` object’s `update` method. Note that the authentication information resides in the `Account` object, and that you must add the `Account` object information as a first step in a new call.

```
 
 // Create a new Account object
 $account = new Account();
  
 // Provide basic account information: a Customer name, and
 // a unique Customer ID
 $account->setName('Somebody Q. Customer'); 
 $account->setMerchantAccountId('IN9430-8421');
  
 // 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);
  
 // To set information about the customer's email contact info
 $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
    $returnedAccount = $response['data']->account;
    $accountVid = $returnedAccount->getVID();
 }
```

When you create an `Account` object, Subscribe assigns it a globally unique Vindicia identifier (VID). As the preceding example illustrates, your application can capture the VID for later use.

The `Account` object also includes a data member called `merchantAccountId`, which enables you to assign your own identifier for the account, such as a database login, user name, or email address. Be certain to specify a unique value for this field when creating an Account.

For more information, see Section 1: The Account Object in the **Subscribe API Guide**.

**Parent topic:**[Working with Accounts](../topics/ProgGuide_Accounts)


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