Creating a New Active Account with the create Call
From API Documentation
To create a new active account, you will be using a number of different objects. The following method uses the create call to create an account, a contact, and a payment method.
Important: Both the create and subscribe calls will create a new account; however, there are differences.
- If you want to create an account without creating a subscription, use the create call. If you use create to create an account, subscribeWithExistingAccount (a variation of subscribe) call will need to be used to create a subscription for that account.
- If you want to create the account along with the subscription and the initial payment information, use the subscribe call.
Contents |
Step 1: Use the create() Call to Create an Instance of Account
Set the following fields:
- Specify the AccountNumber. Please note that Zuora will assign one in the UI, but not via the API. This value is different than the ID and is usually an external business identifier for the account. NOTE: This value cannot begin with the Account Number prefix configured in the Zuora tenant.
- Set the AutoPay to false. If AutoPay is to be enabled, an electronic PaymentMethod has to be entered first and it's ID submitted as the DefaultPaymentMethod for this account (please step 4).
- Set the Batch to one of the 20 pre-set values (from Batch1 to Batch20).
- Set the BillCycleDay. Please note that this value should be one of the bill cycle days configured in the Zuora tenant.
- Specify the Currency for this account, this needs to be one of the currencies that the Zuora tenant has been configured for.
- Set the Name for the account.
- Set the PaymentTerm to Due Upon Receipt. Please note that the value should reflect a valid payment term configured in the Zuora tenant.
- Set the Status to Draft.
Next, create the new account. See the create() API call.
The SOAP call envelope payload should look like the following:
<ns1:create> <ns1:zObjects xsi:type="ns2:Account"> <ns2:AccountNumber>123</ns2:AccountNumber> <ns2:AutoPay>false</ns2:AutoPay> <ns2:Batch>Batch1</ns2:Batch> <ns2:BillCycleDay>1</ns2:BillCycleDay> <ns2:Currency>USD</ns2:Currency> <ns2:Name>ACME</ns2:Name> <ns2:PaymentTerm>Due Upon Receipt</ns2:PaymentTerm> <ns2:Status>Draft</ns2:Status> </ns1:zObjects> </ns1:create>
Step 2: Create a Contact for the Account
Set the following fields:
- Specify the AccountId.
- Set the Country. If the country is United States, please also set the State. Please look up country and state values here.
- Set the FirstName and LastName.
- Set the WorkEmail.
Next, create the new contact. See the create() API call.
The SOAP call envelope payload should look like this:
<ns1:create> <ns1:zObjects xsi:type="ns2:Contact"> <ns2:AccountId>4028e48520410c9a0120413522b857de</ns2:AccountId> <ns2:Country>United States</ns2:Country> <ns2:FirstName>Bill</ns2:FirstName> <ns2:LastName>To</ns2:LastName> <ns2:State>California</ns2:State> <ns2:WorkEmail>bill.to@zuora.com</ns2:WorkEmail> </ns1:zObjects> </ns1:create>
Step 3: Create a PaymentMethod for the Account
Set the following fields:
- Specify the AccountId.
- Set the payment method information. For a Credit Card, these include holder name, card type, card number, expiration month/year, address, city, country, etc.
- Set the Type to the PaymentMethod type being entered. For a Credit Card, this would be CreditCard.
Next, create the new payment method. See the create() API call.
The SOAP call envelope payload should look like this:
<ns1:create> <ns1:zObjects xsi:type="ns2:PaymentMethod"> <ns2:AccountId>4028e48520410c9a0120413522b857de</ns2:AccountId> <ns2:CreditCardAddress1>123 Lane St.</ns2:CreditCardAddress1> <ns2:CreditCardCity>San Francisco</ns2:CreditCardCity> <ns2:CreditCardCountry>United States</ns2:CreditCardCountry> <ns2:CreditCardExpirationMonth>9</ns2:CreditCardExpirationMonth> <ns2:CreditCardExpirationYear>2018</ns2:CreditCardExpirationYear> <ns2:CreditCardHolderName>Bill To</ns2:CreditCardHolderName> <ns2:CreditCardNumber>4111 1111 1111 1111</ns2:CreditCardNumber> <ns2:CreditCardPostalCode>95611</ns2:CreditCardPostalCode> <ns2:CreditCardState>California</ns2:CreditCardState> <ns2:CreditCardType>Visa</ns2:CreditCardType> <ns2:Type>CreditCard</ns2:Type> </ns1:zObjects> </ns1:create>
Step 4: Update the Account
Set the following fields:
- Set Id for the Account created in step 1.
- Set BillToId to the Contact Id returned in step 2.
- Set SoldToId to the Contact Id returned in step 2. Please note that the BillToId and SoldToId can be different, if another Contact is created.
- Set DefaultPaymentMethod to the PaymentMethod Id returned in step 3. Please note that if no PaymentMethod was created, Zuora has a number of pre-configured, global PaymentMethod placeholders, including one for Cash, Check, and Other, among others.
- Set Status to Active".
Next, update the Account.
The SOAP call envelope payload should look like this:
<ns1:update> <ns1:zObjects xsi:type="ns2:Account"> <ns2:Id>4028e48520410c9a0120413522b857de</ns2:Id> <ns2:BillToId>4028e48520410c9a01204135825757df</ns2:BillToId> <ns2:SoldToId>4028e48520410c9a01204135825757df</ns2:SoldToId> <ns2:DefaultPaymentMethodId>4028e6992010ee42012019a485112d70</ns2:DefaultPaymentMethodId> <ns2:Status>Active</ns2:Status> </ns1:zObjects> </ns1:update>
