Update Contact Information for an Account

Zuora requires two types of contacts to be associated with an account: bill-to contact and sold-to contact. The bill-to contact determines where the invoice should be delivered, whereas the sold-to contact determines how taxes are calculated. If the invoice delivery preference is email, the bill-to contact must contain an email address.

In this use case, we will update the sold-to contact information of an account using the Update an account operation.

cURLJavaNode
Copy
Copied
curl --request PATCH
     --url https://rest.apisandbox.zuora.com/v2/accounts/2c92c0f86a8dd422016a9e7a70116b0d 
     --header 'Authorization: Bearer 06a297740b184fc384bc57cbe8a04e53'
     --header 'Content-Type: application/json'
     --data '{
               "sold_to":{
                   "first_name": "Jane",
                   "last_name": "Doe",
                   "address": {
                       "line1": "No.111, Street ABC",
                       "city": "San Francisco",
                       "state": "CA",
                       "country": "United States"
                    }
                }
     }'
Copy
Copied
String accountId = "2c92c0f86a8dd422016a9e7a70116b0d";

Address soldToAddress = new Address()
    .line1("No.123, Street ABC")
    .city("San Francisco")
    .state("CA")
    .country("United States");

AccountPatchRequest accountPatchRequest = new AccountPatchRequest()
    .soldTo(new AccountContactPatchRequest()
        .firstName("Jane")
        .lastName("Doe")
        .address(soldToAddress));

Account updatedAccount = zuoraClient.accounts().updateAccount(accountId,accountPatchRequest);
Copy
Copied
const accountId = '2c92c0f86a8dd422016a9e7a70116b0d';
 
const accountPatchRequest = {
    sold_to:{
        first_name: 'John',
        last_name: 'Doe',
        address: {
            country: 'United States',
            state: 'CA',
            city: 'San Francisco',
            line1: 'No.111, Street ABC'
        }
    }
};
 
const updatedAccount = await zuoraClient.accounts.updateAccount(accountId, accountPatchRequest);