Skip to content

Addresses

Addresses

1
2
3
4
5
6
7
8
9
{
  "id": "addr_9Cle7TXGHcadHymx4Kl5cQYk",
  "created": 1538762174,
  "line1": "12 rue des champs",
  "city": "Paris",
  "zip_code": "75008",
  "country": "FR",
  "live_mode": false
}

The address object is defined as follows:

Field Description Type
id Address id String, fixed size = 29
line1 First line of the street address String, min = 3, max = 50
line2 Second line of the street address String, min = 3, max = 50
line3 Third line of the street address String, min = 3, max = 50
city City of the address String, min = 1, max = 50
zip_code Zip code of the city String, min = 2, max = 16
state State of the address String, min = 1, max = 3
country Country of the address String, min = 2, max = 2
created The Unix timestamp representing creation date of the object in local time Int
live_mode Test or Live mode Boolean inherited from a payment object if linked, default False

Addresses objects created in Test mode cannot be used in Live mode. Likewise, objects created in Live mode cannot be used in Test mode.

Create a address

HTTP request

/v1/addresses/

Data parameters

Parameter Field
email Optional
line1 Optional
line2 Optional
line3 Optional
city Mandatory
zip_code Mandatory
state Optional
country Mandatory

Code examples

1
2
3
4
5
6
7
8
curl -X POST "https://api.stancer.com/v1/addresses/" \
  --header "Content-Type: application/json" \
  --data '{
    "line1": "12 rue des champs",
    "city": "Paris",
    "zip_code": "75008",
    "country": "FR"
}'

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
9
{
  "created": 1538762174,
  "line1": "12 rue des champs",
  "city": "Paris",
  "zip_code": "75008",
  "country": "FR",
  "id": "addr_9Cle7TXGHcadHymx4Kl5cQYk",
  "live_mode": false
}

Get address data

HTTP request

/v1/addresses/
id_address

Query parameters

Parameter Description
id_address Address id

Return parameters

The request will return the address object asssociated with the id_address you provided. If the id_address does not exist, the API will return a 404 HTTP response code.

Code examples

1
curl "https://api.stancer.com/v1/addresses/addr_9Cle7TXKkjhwqcWx4Kl5cQYk"

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
9
{
  "created": 1538762174,
  "line1": "12 rue des champs",
  "city": "Paris",
  "zip_code": "75008",
  "country": "FR",
  "id": "addr_9Cle7TXGHcadHymx4Kl5cQYk",
  "live_mode": false
}

Update a address

HTTP request

/v1/addresses/
id_address

Query parameters

Parameter Description
id_address Address id

Data parameters

Parameter Field
email Optional
line1 Optional
line2 Optional
line3 Optional
city Mandatory
zip_code Mandatory
state Optional
country Mandatory

Return parameters

The above command returns an HTTP 204 code if correctly processed or an HTTP 404 code if the address does not exist.

Code examples

1
2
3
4
5
curl -X PATCH "https://api.stancer.com/v1/addresses/addr_9Cle7TXKkjhwqcWx4Kl5cQYk" \
  --header "Content-Type: application/json" \
  --data '{
    "email": "david@coaster.com"
}'

Delete an address

HTTP request

/v1/addresses/
id_address

Query parameters

Parameter Description
id_address Address id

Return parameters

The above command returns an HTTP 204 code if correctly processed or an HTTP 404 code if the address does not exist.

Code examples

1
url -X DELETE "https://api.stancer.com/v1/addresses/addr_9Cle7TXKkjhwqcWx4Kl5cQYk"