Sharable Cash

Customer Profile Address

The Customer Profile Address has the following required and optional fields:

Field NameLength/FormatValidationRequired: yes/no
address_type_idPredined in the dictionary:
GET /dictionaries/address-types
DigitsYes
address_line11-256 charactersAny symbolsYes
address_line21-256 charactersAny symbolsNo
city1-50 charactersAny symbolsYes
statePredefined in the states list in the dictionary:
GET /dictionaries/countries/{country-id}/states
DigitsYes
countryPredefined in the states list in the dictionary:
GET /dictionaries/countries
DigitsYes
zipxxxxx or xxxxx-xxxxRegex validationYes
first_name1-50 charactersAny symbolsYes
last_name1-50 charactersAny symbolsYes
is_defaulttrue/false Yes

 

 

 

 

 

 


 

 

 

 

Create a Customer Profile Address

To Create a Customer Profile Address, you should have a Customer Profile Individual already created.

1. To create a Customer Profile Address, you must know the customer_profile_id. You may check it by getting all the Customer Profiles and filtering them out but specific parameters:

GET /customer-profiles

2. Get the address_type_id

Three types of Addresses are supported currently: Mailing, Street and Billing. Check the Address Type in the Dictionary to see the details.

GET /dictionaries/address-types

//Sample response

{
  "paging": {
    "page_size": 50,
    "page_number": 1,
    "total_count": 3,
    "last_evaluated_key": null
  },
  "data": [
    {
      "address_type_id": 1,
      "address_type_name": "Mailing",
      "address_type_display_name": "Mailing",
      "address_type_description": "A mailing address is the official address where you get your mail."
    },
    {
      "address_type_id": 2,
      "address_type_name": "Street",
      "address_type_display_name": "Street",
      "address_type_description": "A physical address designates the actual geographical location of your house."
    },
    {
      "address_type_id": 3,
      "address_type_name": "Billing",
      "address_type_display_name": "Billing",
      "address_type_description": "Address connected to a specific form of payment, which is typically a credit or debit card."
    }
  ],
  "errors": null
}

3. Get your country_id

GET /dictionaries/countries

//Sample response

{
  "paging": {
    "page_size": 50,
    "page_number": 1,
    "total_count": 1,
    "last_evaluated_key": null
  },
  "data": [
    {
      "country_id": 1,
      "country_name": "USA",
      "country_display_name": "United States of America",
      "country_two_letter_code": "US",
      "country_three_letter_code": "USA"
    }
  ],
  "errors": null
}

Currently, only USA country is supported, so your country_id is 1.

4. Get the state_id

GET /dictionaries/countries/{country_id}/states

and look through the list for the state you want to add an address to.

//Sample response (Example for California)

The list  is limited for demonstration purposes

{
  "paging": {
    "page_size": 50,
    "page_number": 1,
    "total_count": 50,
    "last_evaluated_key": null
  },
  "data": [
    {
      "state_id": 5,
      "country_id": 1,
      "state_name": "California",
      "state_short_name": "CA"
    }
  ],
  "errors": null
}

5. Create a default Customer Profile Address

You may create more than one Address for a Customer Profile. Just one Customer Profile Address can be default though.

To make an Address default set "is_default": true in your request body.

POST /customer-profiles/{customer_profile_id}/addresses

//Sample request

{
  "address_type_id": 1,
  "is_default": true,
  "country_id": 1,
  "state_id": 15,
  "first_name": "Jane",
  "last_name": "Smith",
  "address_line1": "206 S Main St",
  "address_line2": "",
  "city": "Ohio",
  "zip": "43001"
}

//Sample response

{
  "paging": null,
  "data": [
    {
      "id": "cpa_LEeBCLNqzwDTRt2A"
    }
  ],
  "errors": null
}

As a result, you get an address_id, which then can be used for verification and/or update. 

6. Verify the created address 

GET /customer-profiles/{customer_profile_id}/addresses/{address_id}

//Sample response

{
  "paging": null,
  "data": [
    {
      "address_id": "cpa_LEeBCLNqzwDTRt2A",
      "address_type_id": 2,
      "is_default": true,
      "country_id": 1,
      "state_id": 1,
      "first_name": "Jane",
      "last_name": "Smith",
      "address_line1": "206 S Main St",
      "address_line2": "",
      "city": "Ohio",
      "zip": "43001",
      "created_by": "8CB33A236F55D8A6",
      "created_datetime": "2023-04-24T08:56:03.697",
      "modified_by": "8CB33A236F55D8A6",
      "modified_datetime": "2023-04-24T08:56:03.697"
    }
  ],
  "errors": null
}

7. To check all the Addresses created for the Customer Profile, use the following request:

GET /customer-profiles/{customer_profile_id}/addresses

//Sample response

{
  "paging": {
    "page_size": 50,
    "page_number": 1,
    "total_count": 2,
    "last_evaluated_key": null
  },
  "data": [
    {
      "address_id": "cpa_LEeBCLNqzwDTRt2A",
      "address_type_id": 2,
      "is_default": true,
      "country_id": 1,
      "state_id": 1,
      "first_name": "Jane",
      "last_name": "Smith",
      "address_line1": "206 S Main St",
      "address_line2": "",
      "city": "Ohio",
      "zip": "43001",
      "created_by": "8CB33A236F55D8A6",
      "created_datetime": "2023-04-24T08:56:03.697",
      "modified_by": "8CB33A236F55D8A6",
      "modified_datetime": "2023-04-24T08:56:03.697"
    },
    {
      "address_id": "cpa_YV3HOO4pCbEOKwF7",
      "address_type_id": 1,
      "is_default": true,
      "country_id": 1,
      "state_id": 1,
      "first_name": "Jane",
      "last_name": "Smith",
      "address_line1": "226 Deerfield Rd",
      "address_line2": "",
      "city": "Port Orange",
      "zip": "32119",
      "created_by": "8CB33A236F55D8A6",
      "created_datetime": "2023-04-24T08:55:02.123",
      "modified_by": "8CB33A236F55D8A6",
      "modified_datetime": "2023-04-24T08:55:02.123"
    }
  ],
  "errors": null
}

Update a Customer Profile Address

You can’t update Address Type in the Customer Profile Address.

To be able to update a Customer Profile Address, you need to know the customer_profile_id and address_id, which you can get using the following queries:

GET/customer-profiles to find the Customer Profile and copy customer_profile_id and GET/customer-profiles/{customer_profile_id}/addresses to get the address_id

Once you have the ids, follow the next steps:

1. Update the needed fields in the address:

PUT /customer-profiles/{customer_profile_id}/addresses/{address_id}

2. Verify the updated address:

GET /customer-profiles/{customer_profile_id}/addresses/{address_id}

Delete a Customer Profile Address

You can’t delete a default Customer Profile Address. If you want to delete a particular address currently set as default, you need to create an alternative default address and then delete this one.

To set an address as the default set "is_default": true in your Request body. See details in the Create a Customer Profile Address section.

1. Before deleting a default Customer Profile Address, you need to create another default Address:

POST /customer-profiles/{customer_profile_id}/addresses

OR

2. If the Address you’re going to delete is not a default Address, proceed to the step below:

DELETE /customer-profiles/{customer_profile_id}/addresses/{address_id}

Make sure you put the correct address_id not to delete the wrong address.