Add an Address to a Profile
POST /customervault/v1/profiles/profile_id/addresses
See our full API documentation for a complete description of the parameters required for the address creation request.
In the previous example you created a profile for a customer. As a result, the API returned a profile ID representing that profile.
The Customer Vault API allows you to add multiple addresses to your customer's profile. To add an address to the profile, you must use that profile ID and make a POST request to the addresses endpoint of the relevant profile.
curl -X POST https://api.test.paysafe.com/customervault/v1/profiles/716adb4f-6b85-4089-ba9c-d9c0eb649cd7/addresses \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"nickName":"home",
"street" : "100 Queen Street West",
"city" : "Toronto",
"state" : "ON",
"country" : "CA",
"zip" : "M5H 2N2"
}'
Element | Type | Required? | Description |
---|---|---|---|
city | string | Yes | This is the customer's city. |
country | string length=2 | Yes | This is the customer's country. |
defaultShippingAddressIndicator | boolean | No | This is a flag marking this address as the default shipping address. |
nickName | string | No | This is an alias for this address defined by the customer e.g., "home address". |
phone | string length<=40 | No | This is the recipient's phone number. |
recipientName | string length<=255 | No | This is the name of the recipient at this address, if it is different from the name in the profile. |
state | string length<=40 | No | This is the customer's state/province/region. |
street | string length<=50 | Yes | This The first line of the customer's address. |
street2 | string length<=50 | No | This is the second line of the customer's address. |
zip | string length<=10 | Yes | This is the customer's zip code. |
{
"id" : "81ffcddf-ad82-40d2-aaa0-c4f9c376ad65",
"status" : "ACTIVE",
"street" : "100 Queen Street West",
"city" : "Toronto",
"state" : "ON",
"country" : "CA",
"zip" : "M5H 2N2",
"defaultShippingAddressIndicator" : false
}
The response contains all the details submitted in the request, plus the address id. Make a note of the ID for later use.
Element | Type | Description |
---|---|---|
id | string length<=36 | This is the address identifier. |
status | enum | This is the status of the address request: ACTIVE |
You can look up the Profile and associated Address using a GET request as follows:
GET /customervault/v1/profiles/profile_id?fields=cards,addresses
The fields parameter is a comma-separated list of subcomponents to return. See the API Reference Section for more details.