B2B
Company addresses
Shared billing and shipping addresses, and default addresses.
A company keeps its own address book, shared by its employees. Each address has a type, billing or shipping, and the same fields as a customer address (first_name, company, address_1, city, postal_code, country_code, and so on). All address fields are optional. country_code is two letters.
Who can do what
| Action | Store | Admin |
|---|---|---|
| List | GET /store/companies/me/addresses, any active employee | GET /admin/companies/{id}/addresses |
| Add | POST /store/companies/me/addresses, manage_company | POST /admin/companies/{id}/addresses |
| Update | POST /store/companies/me/addresses/{id}, manage_company | POST /admin/companies/{id}/addresses/{address_id} |
| Delete | DELETE /store/companies/me/addresses/{id}, manage_company | DELETE /admin/companies/{id}/addresses/{address_id} |
Listing works while the company is pending or suspended. Store writes need an active company. Filter a list by type with type=billing or type=shipping.
Default addresses
- A company has at most one default address per type: one billing, one shipping.
- Setting
is_default: trueon an address makes it the default and clears the previous default of that type. - Changing the
typeof a default address moves it to the new type's default and clears the old one there. - Deleting the default leaves the company with no default of that type until you set another.
curl -X POST http://localhost:9000/store/companies/me/addresses \
-H "x-publishable-api-key: pk_..." \
-H "Authorization: Bearer <customer token>" \
-H "Content-Type: application/json" \
-d '{
"type": "shipping",
"is_default": true,
"company": "Northwind Supply",
"address_1": "1 Harbor Way",
"city": "Portland",
"postal_code": "97201",
"country_code": "us"
}'Address changes emit no events. Deleting a company deletes its addresses.
Carts don't pick up company addresses on their own. Send the one you want as the cart's shipping or billing address.