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

# Setting up Accounts

Before you set up HOA you will need to create accounts, where your customers enter identifying information before the payment page is presented.This example shows how to create an account in the Vindicia database. (For more information about creating customer accounts, see [Working with Accounts](https://docs.vindicia.com/bundle/SOAP-Programming-guide/page/SOAP_Programmer_Guide/topics/ProgGuide_Accounts.html).)

1. Receive the form Post of Account sign up fields.

   ```
    
    $product_id = "GamePlay01";
    $billing_plan = $_POST['billing_plan'];
    $name = $_POST['name'];
    $addr1 = $_POST['address1'];
    $addr2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $postalcode = $_POST['zip'];
    $country = $_POST['country'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $coupon = $_POST['coupon'];
   ```

2. Build the Address object

   ```

    $address = new Address();
    $address->setName($name);
    $address->setAddr1($addr1);
    $address->setAddr2($addr2);
    $address->setCity($city);
    $address->setDistrict($state);
    $address->setPostalCode($postalcode);
    $address->setCountry($country);
    $address->setPhone($phone);
   ```

3. Build the Account object, use address.

   ```

    $account_id = 'sgtestaccount' . rand(1000,9999); // generate a random account number
    $account = new Account();
    $account->setMerchantAccountId($account_id);
    $account->setEmailAddress($email);
    $account->setShippingAddress($address); 
    $account->setEmailTypePreference('html');
    $account->setName($name);
   ```

4. Send Account object to Vindicia.

   ```

    $srd = ""; // Soap version 13.0 and higher uses SRD
    $response = $account->update($srd);
   ```

5. Verify that Account creation was successful.

   ```

    $return_code = $response['returnCode'];
    if ($return_code == "200")
    {
     // success
     if (isset($response['data'])) {
     $response_object = $response['data'];
     }
     // It worked. Account was created.
     $account = $response_object->account;
     if ($account_id == $account->merchantAccountId)
     {
     // It was saved in Vindicia's database
     }
    } else {
     // failure
     print "<h2>Error: Could not create account object in Vindicia's database</h2>";
     $return_string = $response['returnString'];
     print $return_code . " " . $return_string;
     exit;
    }
   ```

You can now use `$account_id` as a private name-value pair in the WebSession.

Proceed to [Setting up HOA](Setting_up_HOA#).

**Parent topic:**[Implementing HOA with Hosted Fields](../topics/Implementing_HOA_with_Ho)


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