Update Customer Address

The Payiano's update customer address endpoint allows businesses to modify existing address records when a customer relocates or when address details need correction. This ensures that orders, invoices, and communications are always sent to the correct location, reducing delivery failures and billing errors.

Keeping address data current is essential for maintaining smooth operations. Accurate addresses lead to fewer returned shipments, faster deliveries, and improved customer satisfaction.

In the Payiano system, it's important to note a key operational rule regarding record updates. If a customer address record has been soft deleted, without being permanently removed from the database, any updates to this record are forbidden. This restriction ensures data integrity and consistency, as modifying a soft-deleted record could lead to confusion or inaccuracies in the system management.

To update a soft-deleted customer address, the record must first be restored. Restoration reverts the record's deleted status, making it once again eligible for updates and modifications. This policy is crucial for maintaining a clear and accurate representation of the customer address record, while still retaining the flexibility to recover and revise previously soft-deleted customer address as needed. By enforcing this rule, the Payiano system ensures a streamlined and coherent management process, balancing flexibility with control.

PUT/client/customer_addresses/{customer_address_id}
Sandbox: https://api.payiano.dev/v1/client/customer_addresses/{customer_address_id}
Live: https://api.payiano.com/v1/client/customer_addresses/{customer_address_id}
Security
  • Authorization header with access token is required to access this endpoint: Bearer ACCESS-TOKEN
  • Your access token should be associated to this permission client.customer_addresses.update
Webhook Events

These webhook events will be fired when this endpoint is called, the system will automatically send a notification to the designated webhook URLs.

  • client.customer_address.updated
Request
Request body schema:
application/json
Path parameters:
customer_address_id
required
Type: ulid
Length: 26

The unique ID assigned to each customer address which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every customer address. This ULID is automatically created by our system and is used to uniquely identify and track each customer address in our database.

Query parameters:
identify_by
Type: enum|null
Possible values:
JSON
[
"id", "reference_id" ]

This attribute specifies which identifier is being used to interact with a resource in the Payiano API. It helps the system understand how to identify resource when processing API requests. By default, the identify_by attribute is set to id, so you only need to specify it if you're using a different identifier.

includes
Type: array_of_enums|null
Possible values:
JSON
[
"customer_address.country" ]

A list of additional customer address related objects to eager-load and return with the response. Pass only the relations you need to keep response payloads lean. See Including Resources for the full list of supported include values and usage details.

Request body:
country_code
Type: string

Specify the unique two-letter country code ( e.g EG, SA or AE ) corresponding to the country where customer is located. This code is part of the standard international country codes set by the ISO .

is_default
Type: boolean
Default: false

This attribute specifies if the address is the default one selected for the customer for billing or shipping purposes. It comes into play when the user is directed to the checkout page or when an order is being delivered to them.

reference_id
Type: string|null
Max: 50

It's a unique identifier assigned to each customer address. It's primary role is to distinguish one customer address from another, ensuring that each customer address can be individually tracked and managed without any confusion. Please note that duplicate values are not allowed. Only alpha-numeric characters, dashes, and underscores are allowed: [A-Za-z0-9-_]. The reference_id value is used to Identify Resource when you consume any customer address endpoint with sending identify_by query parameter with value reference_id.

line_one
Type: string|null
Min: 2
Max: 255

The primary address line, typically containing the building or house number and street name. This field is required and must precisely identify the street-level location for deliveries, correspondence, and geographic lookups.

line_two
Type: string|null
Min: 2
Max: 255

An optional secondary address line used for additional information like apartment, suite, or building numbers that help refine the location for delivery services.

city
Type: string|null
Min: 2
Max: 50

This attribute specifies the city in which the address is located. It's essential for routing mail and deliveries within the correct geographical area.

state
Type: string|null
Min: 2
Max: 50

The state or region attribute further narrows down the location, especially in countries with large geographical areas divided into states, provinces, or regions.

zip_code
Type: string|null
Min: 2
Max: 30

Also known as postal code in some regions, this numeric or alphanumeric code is critical for sorting mail and determining delivery routes with precision.

phone_number
Type: string|null
Max: 30

A primary contact number that can be a mobile or cellular number, providing a direct line to the individual or entity associated with the address.

landline_number
Type: string|null
Max: 30

An alternative to the mobile number, this is a fixed-line telephone number associated with the location, useful for contact purposes where mobile signals may be unreliable.

fax_number
Type: string|null
Max: 30

An optional fax number associated with the address. Used to receive documents transmitted over telephone lines in business or institutional contexts where fax communication is still supported.

first_name
Type: string|null
Min: 2
Max: 50

The given name of the individual associated with the address, important for personalizing communication and ensuring the correct recipient for mail or services.

last_name
Type: string|null
Min: 2
Max: 50

The family or surname of the individual, completing the personal identification and used in conjunction with the first name for full clarity on the recipient's identity.

location
Type: object|null

This attribute is used to offer a precise, geographical identification of a place, which is crucial for various applications like mapping, navigation, and location-based services.

lat
required
Type: decimal
Min: -90
Max: 90

The geographic latitude of the address, expressed in decimal degrees. Valid values range from -90 (south pole) to 90 (north pole). Used together with longitude to pinpoint the exact location on a map or coordinate system.

lng
required
Type: decimal
Min: -180
Max: 180

The geographic longitude of the address, expressed in decimal degrees. Valid values range from -180 (west) to 180 (east). Combined with latitude, provides the precise GPS coordinates required for mapping and location-based services.

note
Type: string|null
Min: 2
Max: 255

This free-text field allows for additional information or special instructions related to the address or delivery preferences to be included.

Response
200
Response schema:
application/json
Response body:
customer_address
Type: object

The complete address record including street, city, postal code, and country.

id
Type: ulid
Length: 26

The unique ID assigned to each customer address which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every customer address. This ULID is automatically created by our system and is used to uniquely identify and track each customer address in our database.

country_code
Type: string

Specify the unique two-letter country code ( e.g EG, SA or AE ) corresponding to the country where customer is located. This code is part of the standard international country codes set by the ISO .

type
Type: enum
Possible values:
JSON
[
"billing_address", "shipping_address" ]

This attribute is used to differentiates between types of customer addresses, such as billing or shipping address.

is_default
Type: boolean
Default: false

This attribute specifies if the address is the default one selected for the customer for billing or shipping purposes. It comes into play when the user is directed to the checkout page or when an order is being delivered to them.

reference_id
Type: string|null
Max: 50

It's a unique identifier assigned to each customer address. It's primary role is to distinguish one customer address from another, ensuring that each customer address can be individually tracked and managed without any confusion. Please note that duplicate values are not allowed. Only alpha-numeric characters, dashes, and underscores are allowed: [A-Za-z0-9-_]. The reference_id value is used to Identify Resource when you consume any customer address endpoint with sending identify_by query parameter with value reference_id.

line_one
Type: string|null
Min: 2
Max: 255

The primary address line, typically containing the building or house number and street name. This field is required and must precisely identify the street-level location for deliveries, correspondence, and geographic lookups.

line_two
Type: string|null
Min: 2
Max: 255

An optional secondary address line used for additional information like apartment, suite, or building numbers that help refine the location for delivery services.

city
Type: string|null
Min: 2
Max: 50

This attribute specifies the city in which the address is located. It's essential for routing mail and deliveries within the correct geographical area.

state
Type: string|null
Min: 2
Max: 50

The state or region attribute further narrows down the location, especially in countries with large geographical areas divided into states, provinces, or regions.

zip_code
Type: string|null
Min: 2
Max: 30

Also known as postal code in some regions, this numeric or alphanumeric code is critical for sorting mail and determining delivery routes with precision.

phone_number
Type: string|null
Max: 30

A primary contact number that can be a mobile or cellular number, providing a direct line to the individual or entity associated with the address.

landline_number
Type: string|null
Max: 30

An alternative to the mobile number, this is a fixed-line telephone number associated with the location, useful for contact purposes where mobile signals may be unreliable.

fax_number
Type: string|null
Max: 30

An optional fax number associated with the address. Used to receive documents transmitted over telephone lines in business or institutional contexts where fax communication is still supported.

first_name
Type: string|null
Min: 2
Max: 50

The given name of the individual associated with the address, important for personalizing communication and ensuring the correct recipient for mail or services.

last_name
Type: string|null
Min: 2
Max: 50

The family or surname of the individual, completing the personal identification and used in conjunction with the first name for full clarity on the recipient's identity.

location
Type: object|null

This attribute is used to offer a precise, geographical identification of a place, which is crucial for various applications like mapping, navigation, and location-based services.

lat
Type: decimal
Min: -90
Max: 90

The geographic latitude of the address, expressed in decimal degrees. Valid values range from -90 (south pole) to 90 (north pole). Used together with longitude to pinpoint the exact location on a map or coordinate system.

lng
Type: decimal
Min: -180
Max: 180

The geographic longitude of the address, expressed in decimal degrees. Valid values range from -180 (west) to 180 (east). Combined with latitude, provides the precise GPS coordinates required for mapping and location-based services.

note
Type: string|null
Min: 2
Max: 255

This free-text field allows for additional information or special instructions related to the address or delivery preferences to be included.

customer_id
Type: ulid

This field is the key to associating each address with the correct customer account, enhancing the personalization and accuracy of the transaction process. It not only enhances transaction precision but also contributes significantly to effective customer relationship management and data analysis.

country
Type: object

A country object containing the official name, two-letter ISO code, flag emoji, primary language, international dialing code, and ISO currency code.

name
Type: string

The official name of the country in English or In Arabic if the Accepted-Language header is set to ar. This is the commonly recognized name that would be used in international contexts and is essential for any application that references countries by name.

flag
Type: string

A Unicode representation of the country's flag. Unlike an image URL, Unicode flags are character codes that render as the country's flag emoji across compatible digital platforms. This allows for easy integration of flags into text-based content and interfaces without needing external images.

lang
Type: string|null

This attribute represents the primary language spoken in the country. It's typically expressed in ISO 639-1 format, a two-letter code identifying the language, making it easier for applications to adapt content or interfaces according to the user's region.

code
Type: string

The unique two-letter country code ( e.g EG, SA or AE ) corresponding to the country. This code is part of the standard international country codes set by the ISO .

dial_code
Type: string

The international dialing code for the country, such as +1 for the United States, +44 for the United Kingdom or +20 for Egypt. This code is crucial for making international telephone calls and can be used in applications that require user phone number verification.

currency_code
Type: string

This attribute describes the official currency used in the country, typically denoted by its ISO currency code, such as USD for the United States Dollar, EUR for the Euro or EGP for Egyptian Pound.

is_deleted
Type: boolean
Default: false

Indicates whether the customer address has been soft-deleted. A true value means the record is marked as deleted and excluded from standard listings; a false value means it is active. Soft-deleted records remain in the database and can be restored.

created_at
Type: datetime

The created datetime of the customer address. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

updated_at
Type: datetime

The updated datetime of the customer address. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

deleted_at
Type: datetime|null

The deleted datetime of the customer address. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

Response sample:
JSON
1
{
2
"customer_address": {
3 "id": "01ht3tph1szfa5b02qsay22hk1", 4 "country_code": "EG", 5 "type": "billing_address", 6 "is_default": true, 7 "reference_id": "96bf2bca-61c0-3eba-bc85-bfae3bcfd85f", 8 "line_one": "7th Makram Ebid, Nasr City", 9 "line_two": "Building 174, apartment 12", 10 "city": "Cairo", 11 "state": "Nasr City", 12 "zip_code": "11321", 13 "phone_number": "+201000333000", 14 "landline_number": "6546543213216", 15 "fax_number": "5456464646", 16 "first_name": "Mohsen", 17 "last_name": "Osama", 18
"location": {
19 "lat": 21.32, 20 "lng": 12.63 21 }, 22 "note": null, 23 "customer_id": "01hqjp3f48879znt9v4dysrk2r", 24
"country": {
25 "name": "Egypt", 26 "flag": "🇪🇬", 27 "lang": "AR", 28 "code": "EG", 29 "dial_code": "+20", 30 "currency_code": "EGP" 31 }, 32 "is_deleted": false, 33 "created_at": "1722572118554", 34 "updated_at": "1722572118554", 35 "deleted_at": null 36 } 37}