Add a Default Shipping Address

This section shows you how to add a default customer shipping address.

Endpoint

Test:
POST
https://apitest.cybersource.com
/tms/v2/customers/
{customerTokenId}
/shipping-addresses
Production:
POST
https://api.cybersource.com
/tms/v2/customers/
{customerTokenId}
/shipping-addresses
Production in India:
POST
https://api.in.cybersource.com
/tms/v2/customers/
{customerTokenId}
/shipping-addresses
The
{customerTokenId}
is the customer token ID returned in the
id
field when you created the customer token. For more information, see Create a Customer.

Required Fields for Adding a Default Shipping Address Using the REST API

You can include any of the following fields in the body of the request:
customerTokenId
Include the ID of the customer token you want to retrieve in the URL path.
default
Set to
true
.
shipTo.address1
shipTo.address2
shipTo.administrativeArea
shipTo.company
shipTo.country
shipTo.email
shipTo.firstName
shipTo.lastName
shipTo.locality
shipTo.phoneNumber
shipTo.postalCode

REST Example: Adding a Default Shipping Address

Request
        
{ "default": true, "shipTo": { "firstName": "John", "lastName": "Doe", "company": "Visa", "address1": "1 Market St", "locality": "san francisco", "administrativeArea": "CA", "postalCode": "94105", "country": "US", "phoneNumber": "4158880000", "email": " " } }
Response to a Successful Request
        
{ "_links": { "self": { "href": "/tms/v2/customers/F45FB3E443AC3C57E053A2598D0A9CFF/shipping-addresses/F45FD8DE51A89E9CE053A2598D0AFDFA" }, "customer": { "href": "/tms/v2/customers/F45FB3E443AC3C57E053A2598D0A9CFF" } }, "id": "F45FD8DE51A89E9CE053A2598D0AFDFA", "default": true, "shipTo": { "firstName": "John", "lastName": "Doe", "company": "Visa", "address1": "1 Market St", "locality": "san francisco", "administrativeArea": "CA", "postalCode": "94105", "country": "US", "email": " ", "phoneNumber": "4158880000" }, "metadata": { "creator": "testrest" } }