Address
There are several processes that require Creating, Removing and Updating addresses. User address is required for billing, shipping and delivery. This page covers Address endpoints that are created to programmatically handle Address related tasks.
Create new address
This endpoint allows you to create a new address for a user.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Create Address | /api/v2/commerce/address/create | Create a new Address. |
Required attributes
- Name
address
- Type
- string
- Description
Address content provided by the user
Optional attributes
- Name
id
- Type
- string
- Description
id to identify the user
- Name
title
- Type
- string
- Description
Title of the user e.g. Miss./Mrs./Mr.
- Name
firstName
- Type
- string
- Description
First name of the user
- Name
lastName
- Type
- string
- Description
Last name of the user
- Name
address1
- Type
- string
- Description
Address Line 1 provided by the user
- Name
address2
- Type
- string
- Description
Address Line 2 provided by the user
- Name
address3
- Type
- string
- Description
Address Line 3 provided by the user
- Name
city
- Type
- string
- Description
City name provided by the user
- Name
state
- Type
- string
- Description
State name provided by the user
- Name
country
- Type
- string
- Description
Country name provided by the user
- Name
countryCode
- Type
- string
- Description
Country code provided by the user
- Name
postCode
- Type
- string
- Description
Post code provided by the user
- Name
phoneNo
- Type
- string
- Description
Phone number of the user
- Name
mobileNo
- Type
- string
- Description
Mobile number of the user
- Name
customerId
- Type
- string
- Description
Customer Id to identify the user
- Name
isDefault
- Type
- boolean
- Description
Flag to check if the address is default address
- Name
isDefaultDelivery
- Type
- boolean
- Description
Flag to check if the addresss is default delivery address
- Name
isDefaultForSubscription
- Type
- boolean
- Description
Flag to check if the address is default
- Name
companyName
- Type
- string
- Description
Name of the company provided by the user
- Name
isDefaultBilling
- Type
- boolean
- Description
Flag to check if the address is default billing address
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- object
- Description
Result of the response
- Name
recordId
- Type
- string
- Description
RecordId of the record created
- Name
id
- Type
- number
- Description
Id to identify the address
- Name
isValid
- Type
- boolean
- Description
Flag to check validity of the response
Request
curl --location 'https://api20.bettercommerce.io/api/v2/commerce/address/create' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data '{
"customerId": "",
"isDefault": false,
"isDefaultDelivery": false,
"isDefaultForSubscription": false,
"isDefaultBilling": false,
"id": 0,
"title": "Mr.",
"firstName": "David",
"lastName": "Smith",
"address1": "Address Line 1",
"address2": "Address Line 2",
"address3": "Address Line 3",
"city": "London",
"state": "London",
"country": "United Kingdom",
"countryCode": "UK",
"postCode": "XX55YY",
"phoneNo": "9999999999",
"mobileNo": "888888888",
"companyName": "My Company"
}'
Update an address
This endpoint allows you to update an existing address for a user.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Update Address | /api/v2/commerce/address/:id/update | Update an existing Address. |
Required attributes
- Name
id
- Type
- string
- Description
Id to identify the existing address
- Name
address
- Type
- string
- Description
Address content provided by the user to update the existing address
Optional attributes
- Name
id
- Type
- string
- Description
id to identify the user
- Name
title
- Type
- string
- Description
Title of the user e.g. Miss./Mrs./Mr.
- Name
firstName
- Type
- string
- Description
First name of the user
- Name
lastName
- Type
- string
- Description
Last name of the user
- Name
address1
- Type
- string
- Description
Address Line 1 provided by the user
- Name
address2
- Type
- string
- Description
Address Line 2 provided by the user
- Name
address3
- Type
- string
- Description
Address Line 3 provided by the user
- Name
city
- Type
- string
- Description
City name provided by the user
- Name
state
- Type
- string
- Description
State name provided by the user
- Name
country
- Type
- string
- Description
Country name provided by the user
- Name
countryCode
- Type
- string
- Description
Country code provided by the user
- Name
postCode
- Type
- string
- Description
Post code provided by the user
- Name
phoneNo
- Type
- string
- Description
Phone number of the user
- Name
mobileNo
- Type
- string
- Description
Mobile number of the user
- Name
customerId
- Type
- string
- Description
Customer Id to identify the user
- Name
isDefault
- Type
- boolean
- Description
Flag to check if the address is default address
- Name
isDefaultDelivery
- Type
- boolean
- Description
Flag to check if the addresss is default delivery address
- Name
isDefaultForSubscription
- Type
- boolean
- Description
Flag to check if the address is default
- Name
companyName
- Type
- string
- Description
Name of the company provided by the user
- Name
isDefaultBilling
- Type
- boolean
- Description
Flag to check if the address is default billing address
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- object
- Description
Result of the response
- Name
recordId
- Type
- string
- Description
RecordId of the record updated
- Name
id
- Type
- number
- Description
Id to identify the address
- Name
isValid
- Type
- boolean
- Description
Flag to check validity of the response
Request
curl --location --request PUT 'https://api20.bettercommerce.io/api/v2/commerce/address/:id/update' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data '{
"customerId": "",
"isDefault": false,
"isDefaultDelivery": false,
"isDefaultForSubscription": false,
"isDefaultBilling": false,
"id": 0,
"title": "Mr.",
"firstName": "David",
"lastName": "Smith",
"address1": "Address Line 1",
"address2": "Address Line 2",
"address3": "Address Line 3",
"city": "London",
"state": "London",
"country": "United Kingdom",
"countryCode": "UK",
"postCode": "XX55YY",
"phoneNo": "9999999999",
"mobileNo": "888888888",
"companyName": "My Company"
}'
Response
{
"statusCode": 200,
"status": "OK",
"errors": [],
"success": true,
"message": "Success",
"messageCode": "1000",
"result": {
"recordId": "00000000-0000-0000-0000-000000000000",
"id": 0,
"isValid": false
}
}
Get complete customer address book
This endpoint allows you to get complete customer address book.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Get address book | /api/v2/commerce/address/:customerId | Get complete customer address book. |
Required attributes
- Name
customerId
- Type
- GUID
- Description
Customer / UserId for whom the addressbook is fetched
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- object
- Description
Result of the response
- Name
id
- Type
- string
- Description
id to identify the user
- Name
title
- Type
- string
- Description
Title of the user e.g. Miss./Mrs./Mr.
- Name
firstName
- Type
- string
- Description
First name of the user
- Name
lastName
- Type
- string
- Description
Last name of the user
- Name
address1
- Type
- string
- Description
Address Line 1 provided by the user
- Name
address2
- Type
- string
- Description
Address Line 2 provided by the user
- Name
address3
- Type
- string
- Description
Address Line 3 provided by the user
- Name
city
- Type
- string
- Description
City name provided by the user
- Name
state
- Type
- string
- Description
State name provided by the user
- Name
country
- Type
- string
- Description
Country name provided by the user
- Name
countryCode
- Type
- string
- Description
Country code provided by the user
- Name
postCode
- Type
- string
- Description
Post code provided by the user
- Name
phoneNo
- Type
- string
- Description
Phone number of the user
- Name
mobileNo
- Type
- string
- Description
Mobile number of the user
- Name
customerId
- Type
- string
- Description
Customer Id to identify the user
- Name
isDefault
- Type
- boolean
- Description
Flag to check if the address is default address
- Name
isDefaultDelivery
- Type
- boolean
- Description
Flag to check if the addresss is default delivery address
- Name
isDefaultForSubscription
- Type
- boolean
- Description
Flag to check if the address is default
- Name
companyName
- Type
- string
- Description
Name of the company provided by the user
- Name
isDefaultBilling
- Type
- boolean
- Description
Flag to check if the address is default billing address
Request
curl --location 'https://api20.bettercommerce.io/api/v2/commerce/address/:customerId'
Response
{
"statusCode": 200,
"status": "OK",
"errors": [],
"success": true,
"message": null,
"messageCode": null,
"result": [
{
"customerId": null,
"isDefault": true,
"isDefaultDelivery": false,
"isDefaultForSubscription": false,
"isDefaultBilling": false,
"id": 1276806,
"title": "Mr",
"firstName": "Vikram",
"lastName": "Saxena",
"address1": "Congress House, 14 Lyon Road,",
"address2": null,
"address3": null,
"city": "London",
"state": "",
"country": "United Kingdom",
"countryCode": "GB",
"postCode": "HA12E",
"phoneNo": "0203129272",
"mobileNo": null,
"companyName": null
},
{
"customerId": null,
"isDefault": false,
"isDefaultDelivery": false,
"isDefaultForSubscription": false,
"isDefaultBilling": false,
"id": 1276807,
"title": "Mr",
"firstName": "Vikram",
"lastName": "Saxena",
"address1": "Congress House, 14 Lyon Road,",
"address2": null,
"address3": "",
"city": "London",
"state": "",
"country": "United Kingdom",
"countryCode": "GB",
"postCode": "HA12E",
"phoneNo": "0203129272",
"mobileNo": null,
"companyName": null
}
]
}
Remove all the 'defaults' from address for a customerId.
This endpoint allows you to remove all the defaults from address for a customer.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Removing defaults | /api/v2/commerce/address/:customerId/removedefault | Remove all the 'defaults' from address for a customerId. |
Required attributes
- Name
customerId
- Type
- GUID
- Description
Customer / UserId for whom the address is to be updated
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- boolean
- Description
Result of the response
Request
curl --location --request PUT 'https://api20.bettercommerce.io/api/v2/commerce/address/:customerId/removedefault'
Response
{
"statusCode": 410,
"status": "mollit incididunt reprehenderit id aliqua",
"errors": [
"dolor do",
"sit consequat consectetur"
],
"success": false,
"message": "nisi Lorem deserunt tempor",
"messageCode": "non voluptate veniam et",
"result": true
}
Get a specific address record
This endpoint allows you to get a specific address record for a user.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Get an address record | /api/v2/commerce/address/:customerId/:id | Get a specific address record |
Required attributes
- Name
customerId
- Type
- GUID
- Description
Customer Id of the user
- Name
id
- Type
- number
- Description
Id to identify the address of the user
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- object
- Description
Result of the response
- Name
recordId
- Type
- string
- Description
RecordId of the record updated
- Name
id
- Type
- number
- Description
Id to identify the address
- Name
isValid
- Type
- boolean
- Description
Flag to check validity of the response
- Name
id
- Type
- string
- Description
id to identify the user
- Name
title
- Type
- string
- Description
Title of the user e.g. Miss./Mrs./Mr.
- Name
firstName
- Type
- string
- Description
First name of the user
- Name
lastName
- Type
- string
- Description
Last name of the user
- Name
address1
- Type
- string
- Description
Address Line 1 provided by the user
- Name
address2
- Type
- string
- Description
Address Line 2 provided by the user
- Name
address3
- Type
- string
- Description
Address Line 3 provided by the user
- Name
city
- Type
- string
- Description
City name provided by the user
- Name
state
- Type
- string
- Description
State name provided by the user
- Name
country
- Type
- string
- Description
Country name provided by the user
- Name
countryCode
- Type
- string
- Description
Country code provided by the user
- Name
postCode
- Type
- string
- Description
Post code provided by the user
- Name
phoneNo
- Type
- string
- Description
Phone number of the user
- Name
mobileNo
- Type
- string
- Description
Mobile number of the user
- Name
customerId
- Type
- string
- Description
Customer Id to identify the user
- Name
isDefault
- Type
- boolean
- Description
Flag to check if the address is default address
- Name
isDefaultDelivery
- Type
- boolean
- Description
Flag to check if the addresss is default delivery address
- Name
isDefaultForSubscription
- Type
- boolean
- Description
Flag to check if the address is default
- Name
companyName
- Type
- string
- Description
Name of the company provided by the user
- Name
isDefaultBilling
- Type
- boolean
- Description
Flag to check if the address is default billing address
Request
curl --location 'https://api20.bettercommerce.io/api/v2/commerce/address/:customerId/:id'
Response
{
"statusCode": 200,
"status": "OK",
"errors": [],
"success": true,
"message": "",
"messageCode": "",
"result": {
"id": 0,
"title": "Mr.",
"firstName": "David",
"lastName": "Smith",
"address1": "Address Line 1",
"address2": "Address Line 2",
"address3": "Address Line 3",
"city": "London",
"state": "London",
"country": "United Kingdom",
"countryCode": "UK",
"postCode": "XX55YY",
"phoneNo": "9999999999",
"mobileNo": "888888888",
"customerId": "ee0ffb58-2dc1-49a9-b659-1ae733f0215c",
"isDefault": false,
"isDefaultDelivery": false,
"isDefaultForSubscription": false,
"companyName": "My Company",
"isDefaultBilling": false
}
}
Delete an address
This endpoint allows you to create a new address for a user.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Delete Address | /api/v2/commerce/address/:customerId/:id/delete | Delete an address. |
Required attributes
- Name
customerId
- Type
- GUID
- Description
Customer/user id who is the owner of the address to be deleted. This is required to ensure data integrity
- Name
id
- Type
- number
- Description
addressId to be deleted
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- boolean
- Description
Result of the response
Request
curl --location --request DELETE 'https://api20.bettercommerce.io/api/v2/commerce/address/:customerId/:id/delete'
Response
{
"statusCode": 406,
"status": "sint dolor id ipsum",
"errors": [
"sint",
"aute"
],
"success": true,
"message": "culpa consequat ut",
"messageCode": "consequat sed culpa laborum",
"result": true
}
Set the default billing/delivery address for Standard or Subscription order.
This endpoint allows you to set the default billing/delivery address for Standard or Subscription order.
Developers - API Operations:
Operation | Endpoint | Response |
---|---|---|
Setting address | /api/v2/commerce/address/:customerId/:id/setdefault?type=1&isDefaultBilling=false&isDefaultDelivery=true | Set the default billing/delivery address for Standard or Subscription order. |
Required attributes
- Name
customerId
- Type
- GUID
- Description
Customer / UserId for whom the address is to be updated
- Name
id
- Type
- number
- Description
Id of the address
Optional attributes
- Name
type
- Type
- number
- Description
Type of address, 1=Standard Basket Billing Address, 2=Subscription Basket Address
- Name
isDefaultBilling
- Type
- boolean
- Description
True if this address to be set as default billing address, else false
- Name
isDefaultDelivery
- Type
- boolean
- Description
True if this address to be set as default delivery address, else false
Response Properties
- Name
statusCode
- Type
- number
- Description
Status code of the response
- Name
status
- Type
- string
- Description
Status of the response
- Name
errors
- Type
- array
- Description
List of errors in the response
- Name
success
- Type
- boolean
- Description
Success status of the response
- Name
message
- Type
- string
- Description
Message of the response
- Name
messageCode
- Type
- string
- Description
Message code of the response
- Name
result
- Type
- boolean
- Description
Result of the response
Request
curl --location --request PUT 'https://api20.bettercommerce.io/api/v2/commerce/address/
:customerId/:id/setdefault?type=1
&isDefaultBilling=false
&isDefaultDelivery=true'
Response
{
"statusCode": 410,
"status": "mollit incididunt reprehenderit id aliqua",
"errors": [
"dolor do",
"sit consequat consectetur"
],
"success": false,
"message": "nisi Lorem deserunt tempor",
"messageCode": "non voluptate veniam et",
"result": true
}