Subscriptions can have addresses like "Shipping Address" associated with them. This is apart from the billing address as part of credit card information.
Sample address [ JSON ]
{
"addr": "PO Box 9999",
"city": "Walnut",
"country": "US",
"first_name": "John",
"label": "shipping_address",
"last_name": "Doe",
"object": "address",
"state": "California",
"state_code": "CA",
"subscription_id": "__test__KyVnHhSBWm2yX2rX",
"validation_status": "not_validated",
"zip": "91789"
}
API Index URL GET
https://{site}.chargebee.com/api/v2/addresses
Model Class
Chargebee\Resources\Address\Address
string, max chars=50 Label to identify the address. This is unique for all the address for a subscription.
optional, string, max chars=150 First name
optional, string, max chars=150 Last name
optional, string, max chars=70 Email
optional, string, max chars=250 Company name
optional, string, max chars=50 Phone number
optional, string, max chars=150 Address line 1
optional, string, max chars=150 Address line 2
optional, string, max chars=150 Address line 3
optional, string, max chars=50 Name of the city
optional, string, max chars=50 The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
optional, string, max chars=50 State or Province
optional, string, max chars=50 The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.
Note: If you enter an invalid country code, the system will return an error.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
optional, string, max chars=20 Zip or postal code. The number of characters is validated according to the rules specified here.
optional, enumerated string, default=not_validated The address verification status. Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
Show all values[+]
string, max chars=50 A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
string, max chars=50 Label to identify the address. This is unique for all the address for a subscription.
optional, string, max chars=150 First name
optional, string, max chars=150 Last name
optional, string, max chars=70 Email
optional, string, max chars=250 Company name
optional, string, max chars=50 Phone number
optional, string, max chars=150 Address line 1
optional, string, max chars=150 Address line 2
optional, string, max chars=150 Address line 3
optional, string, max chars=50 Name of the city
optional, string, max chars=50 The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
optional, string, max chars=50 State or Province
optional, string, max chars=50 The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.
Note: If you enter an invalid country code, the system will return an error.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
optional, string, max chars=20 Zip or postal code. The number of characters is validated according to the rules specified here.
optional, enumerated string, default=not_validated The address verification status. Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
Show all values[+]
string, max chars=50 A unique and immutable identifier for the subscription. If not provided, it is autogenerated. Retrieves an address resource for a subscription and the specified label.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Codes
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->retrieve([
"subscription_id" => "__test__KyVnHhSBWm2yX2rX",
"label" => "shipping_address"
]);
$address = $result->address;
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->retrieve([
"subscription_id" => "__test__KyVnHhSBWm2yX2rX",
"label" => "shipping_address"
]);
$address = $result->address;
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->retrieve([
"subscription_id" => "__test__KyVnHhSBWm2yX2rX",
"label" => "shipping_address"
]);
$address = $result->address;
Sample Result [ JSON ]
Show more...
{
"address": {
"addr": "PO Box 9999",
"city": "Walnut",
"country": "US",
"first_name": "John",
"label": "shipping_address",
"last_name": "Doe",
"object": "address",
"state": "California",
"state_code": "CA",
"subscription_id": "__test__KyVnHhSBWm2yX2rX",
"validation_status": "not_validated",
"zip": "91789"
}
}
URL Format
GET
https://{site}.chargebee.com/api/v2/addresses
Method
$chargebee->address->retrieve([<param name> : <value>,<param name> : <value> ...])
required, string, max chars=50 A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
required, string, max chars=50 Label to identify the address. This is unique for all the address for a subscription.
always returned required
Resource object representing address
Sample admin console URL
https://{site}.chargebee.com/admin-console/addresses/123x
Adds or replaces the address for a subscription. If an address is already present for the specified label, it will be replaced otherwise new address is added with that label.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Codes
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->update([
"subscription_id" => "__test__KyVnHhSBWm3I82re",
"label" => "shipping_address",
"first_name" => "Benjamin",
"last_name" => "Ross",
"addr" => "PO Box 9999",
"city" => "Walnut",
"state" => "California",
"zip" => "91789",
"country" => "US"
]);
$address = $result->address;
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->update([
"subscription_id" => "__test__KyVnHhSBWm3I82re",
"label" => "shipping_address",
"first_name" => "Benjamin",
"last_name" => "Ross",
"addr" => "PO Box 9999",
"city" => "Walnut",
"state" => "California",
"zip" => "91789",
"country" => "US"
]);
$address = $result->address;
require __DIR__ . '/vendor/autoload.php';
use Chargebee\ChargebeeClient;
$chargebee = new ChargebeeClient(options: [
"site" => "{site}",
"apiKey" => "{apiKey}",
]);
$result = $chargebee->address()->update([
"subscription_id" => "__test__KyVnHhSBWm3I82re",
"label" => "shipping_address",
"first_name" => "Benjamin",
"last_name" => "Ross",
"addr" => "PO Box 9999",
"city" => "Walnut",
"state" => "California",
"zip" => "91789",
"country" => "US"
]);
$address = $result->address;
Sample Result [ JSON ]
Show more...
{
"address": {
"addr": "PO Box 9999",
"city": "Walnut",
"country": "US",
"first_name": "Benjamin",
"label": "shipping_address",
"last_name": "Ross",
"object": "address",
"state": "California",
"state_code": "CA",
"subscription_id": "__test__KyVnHhSBWm3I82re",
"validation_status": "not_validated",
"zip": "91789"
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/addresses
Method
$chargebee->address->update([<param name> : <value>,<param name> : <value> ...])
required, string, max chars=50 A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
required, string, max chars=50 Label to identify the address. This is unique for all the address for a subscription.
optional, string, max chars=150 First name.
optional, string, max chars=150 Last name.
optional, string, max chars=70 Email.
optional, string, max chars=250 Company name.
optional, string, max chars=50 Phone number.
optional, string, max chars=150 Address line 1.
optional, string, max chars=150 Address line 2.
optional, string, max chars=150 Address line 3.
optional, string, max chars=50 Name of the city.
optional, string, max chars=50 The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
optional, string, max chars=50 The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=20 Zip or postal code. The number of characters is validated according to the rules specified here.
optional, string, max chars=50 The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.
Note: If you enter an invalid country code, the system will return an error.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
.
optional, enumerated string, default=not_validated The address verification status. Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
Show all values[+]
always returned required
Resource object representing address
Sample admin console URL
https://{site}.chargebee.com/admin-console/addresses/123x