This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Accounts in Zuora

Overview

The following operations allow you to work with accounts. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with transactions, see Sample configuration.

OperationDescription
createAccountsCreate a new account
getAccountsSummaryRetrieve all details of the account
updateAccountsupdate the existing account
getAccountsRetrieve the account details

Operation details

This section provides further details on the operations related to discussions.

Create Accounts

The createAccounts operation creates a new customer account.

createAccounts
<zuora.createAccounts>
    <name>{$ctx:name}</name>
    <currency>{$ctx:currency}</currency>
    <creditCard>{$ctx:creditCard}</creditCard>
    <billCycleDay>{$ctx:billCycleDay}</billCycleDay>
    <billToContact>{$ctx:billToContact}</billToContact>
    <subscription>{$ctx:subscription}</subscription>
    <notes>{$ctx:notes}</notes>
    <invoiceCollect>{$ctx:invoiceCollect}</invoiceCollect>
    <invoiceTargetDate>{$ctx:invoiceTargetDate}</invoiceTargetDate>
    <autoPay>{$ctx:autoPay}</autoPay>
    <paymentTerm>{$ctx:paymentTerm}</paymentTerm>
    <soldToContact>{$ctx:soldToContact}</soldToContact>
    <batch>{$ctx:batch}</batch>
    <crmId>{$ctx:crmId}</crmId>
    <invoiceTemplateId>{$ctx:invoiceTemplateId}</invoiceTemplateId>
    <communicationProfileId>{$ctx:communicationProfileId}</communicationProfileId>
    <paymentGateway>{$ctx:paymentGateway}</paymentGateway>
    <cf_txtn__c>{$ctx:cf_txtn__c}</cf_txtn__c>
    <cf_pkn__c>{$ctx:cf_pkn__c}</cf_pkn__c>
    <hpmCreditCardPaymentMethodId>{$ctx:hpmCreditCardPaymentMethodId}</hpmCreditCardPaymentMethodId>
    <invoice>{$ctx:invoice}</invoice>
    <collect>{$ctx:collect}</collect>
    <invoiceSeparately>{$ctx:invoiceSeparately}</invoiceSeparately>
    <applyCreditBalance>{$ctx:applyCreditBalance}</applyCreditBalance>
</zuora.createAccounts>
Properties

name: Required -The name of the account.

currency: Required -The type of the currency.

creditCard: Conditional  -The container for the information on a credit card to associate with this account You must provide either this structure or the  hpmCreditCardPaymentMethodId  field, but not both.

billCycleDay: Conditional -The account's bill cycle day (BCD), when bill runs generate invoices for the account. If no subscription is being created, this field is required. Specify any day of the month (1-31, where 31 = end-of-month), or 0 for auto-set. 

billToContact : Required -The container for bill-to contact information.

subscription : Conditional -The Container for subscription information, used if creating a subscription for the new account at the time of account creation.

notes : The description of the account, string of up to 65,535 characters.

invoiceCollect : The invoice and collect field.

invoiceTargetDate : The target date of the invoice.  In  yyyy-mm-dd  format; defaults to the current date.

autoPay : The future payments are to be automatically billed. Possible values are:  true false .

paymentTerm :The payment terms for this account. Possible values are " Due Upon Receipt ", " Net 30 ", " Net 60 ", " Net 90 ".

soldToContact : The container for optional sold-to contact. If a sold-to contact is not specified, one is created from the bill-to contact.

batch :The alias name given to a batch.

crmId :The CRM account ID for the account.

invoiceTemplateId : The Invoice template ID.

communicationProfileId :The ID of a communication profile.

paymentGateway : The name of the payment gateway instance. If null or left unassigned, the Account will use the Default Gateway.

cf_txtn__c : The one or more optional custom field.

cf_pkn__c : The  one or more optional custom field.

hpmCreditCardPaymentMethodIdThe ID of the HPM credit card payment method associated with this account. You must provide either this field or the  creditCard  structure, but not both.

invoice :Creates an invoice for a subscription. The invoice generated in this operation is only for this subscription, not for the entire customer account.

collect  : The collection for an automatic payment for a subscription. The collection generated in this operation is only for this subscription, not for the entire customer account. The default value is  true .(Prerequisite:  invoice  must be  true )

  invoiceSeparately  :The  Separates a single subscription from other subscriptions and invoices the charge independently. If the value is  true , the subscription is billed separately from other subscriptions. If the value is  false , the subscription is included with other subscriptions in the account invoice.(Prerequisite: The default subscription setting  Enable Subscriptions to be Invoiced Separately  must be set to Yes)

applyCreditBalance :Applies a credit balance to an invoice. If the value is  true , the credit balance is applied to the invoice. If the value is  false , no action is taken.(Prerequisite:  invoice  must be  true )

Sample request

Following is a sample REST/JSON request that can be handled by the  createAccounts  operation.

Sample Request for createAccounts
{
  "apiUrl":"https://apisandbox-api.zuora.com/rest",
  "apiVersion":"v1",
  "apiAccessKeyId":"ZuoraTest@wso2.com",
  "apiSecretAccessKey":"ZuoraTest@wso2",
  "billCycleDay": 1,
  "name": "Test Account2",
  "currency": "USD",
  "billToContact":  {
    "address1": "3400 Bridge Pkwy",
    "address2": "#000",
    "city": "Redwood City",
    "country": "United States",
    "county": "San Mateo",
    "fax": "+1(123)4567890",
    "firstName": "J",
    "homePhone": "+1(123)4567890",
    "lastName": "C",
    "mobilePhone": "+1(123)4567890",
    "nickname": "J",
    "otherPhone": "+1(123)4567890",
    "otherPhoneType": "Other",
    "personalEmail": "j.c@abc.com",
    "zipCode": "94000",
    "state": "CA",
    "taxRegion": "CA",
    "workEmail": "j.c@abc.com",
    "workPhone": "+1(123)4567890"
  },
  "creditCard":  {
    "cardType": "Visa",
    "cardNumber": "4111111111111111",
    "expirationMonth": 12,
    "expirationYear": 2020,
    "securityCode": "123",
    "cardHolderInfo":  {
      "cardHolderName": "Joe",
      "addressLine1": "3400 Bridge Pkwy",
      "addressLine2": "#000",
      "city": "null",
      "zipCode": "94000",
      "country": "United States",
      "phone": "+1(123)4567890",
      "email": "j.c@abc.com"
    }
  },
  "subscription": {
    "termType": "TERMED",
    "initialTerm": 12,
    "autoRenew": false,
    "renewalTerm": 3,
    "notes": "This is a trial subscription for POST account demo.",
    "subscribeToRatePlans": [
      {
        "productRatePlanId": "Product rate plan ID",
        "chargeOverrides": [
          {
            "productRatePlanChargeId": "Product rate-plan charge ID",
            "quantity": 5
          }
        ]
      }
    ],
    "contractEffectiveDate": "2013-01-01"
  },
  "invoiceCollect":"false",
  "invoiceTargetDate":"2013-01-01"
}
Related Zuora documentation

http://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Accounts/1_Create_account

Get Account Summary

The getAccountsSummary operation retrieves detailed information about the specified customer account.

getAccountsSummary
<zuora.getAccountsSummary>
    <accountKey>{$ctx:accountKey}</accountKey>
</zuora.getAccountsSummary>
 Properties

  accountKey :Required - The account number or account ID.

Sample request

Following is a sample REST/JSON request that can be handled by the getAccountsSummary  operation.

Sample Request for getAccountsSummary
{
  "apiUrl":"https://apisandbox-api.zuora.com/rest",
  "apiVersion":"v1",
  "apiAccessKeyId":"ZuoraTest@wso2.com",
  "apiSecretAccessKey":"ZuoraTest@wso2",
  "accountKey":"A00000660"
} 
Related Zuora documentation

http://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Accounts/3_GET_account_summary

Get Accounts

The getAccounts operation retrieves basic information about the specified customer account.

getAccounts
<zuora.getAccounts>
    <accountKey>{$ctx:accountKey}</accountKey>
</zuora.getAccounts>
Properties

accountKey  :Required - The account number or account ID.

Sample request

Following is a sample REST/JSON request that can be handled by the  getAccounts  operation.

Sample Request for getAccounts
{
  "apiUrl":"https://apisandbox-api.zuora.com/rest",
  "apiVersion":"v1",
  "apiAccessKeyId":"ZuoraTest@wso2.com",
  "apiSecretAccessKey":"ZuoraTest@wso2",
  "accountKey":"A00000660"
}
Related Zuora documentation

http://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Accounts/2_Get_account_basics

Update Accounts

The updateAccounts operation updates a customer account by specifying the account-key.

updateAccounts
<zuora.updateAccounts>
    <accountKey>{$ctx:accountKey}</accountKey>
    <name>{$ctx:name}</name>
    <billToContact>{$ctx:billToContact}</billToContact>
    <soldToContact>{$ctx:soldToContact}</soldToContact>
	<batch>{$ctx:batch}</batch>
	<notes>{$ctx:notes}</notes>
	<crmId>{$ctx:crmId}</crmId>
	<autoPay>{$ctx:autoPay}</autoPay>
	<invoiceTemplateId>{$ctx:invoiceTemplateId}</invoiceTemplateId>
    <communicationProfileId>{$ctx:communicationProfileId}</communicationProfileId>
	<cf_txtn__c>{$ctx:cf_txtn__c}</cf_txtn__c>
    <cf_pkn__c>{$ctx:cf_pkn__c}</cf_pkn__c>
	<paymentGateway>{$ctx:paymentGateway}</paymentGateway>
</zuora.updateAccounts>
Properties

accountKey  :Required - The account number or account ID.

name: Required -The name of the account.

billToContact : Required -The container for bill-to contact information.

soldToContact : The container for optional sold-to contact. If a sold-to contact is not specified, one is created from the bill-to contact.

batch :The alias name given to a batch.

notes The description of the account, string of up to 65,535 characters.

  crmId :The CRM account ID for the account.

autoPay : The future payments are to be automatically billed. Possible values are:  true false .

invoiceTemplateId : The Invoice template ID.

communicationProfileId :The ID of a communication profile.

cf_txtn__c : The one or more optional custom field.

cf_pkn__c :The one or more optional custom field.

paymentGateway : The name of the payment gateway instance. If null or left unassigned, the Account will use the Default Gateway.

Sample Request

Following is a sample REST/JSON request that can be handled by the  updateAccounts operation.

Sample Request for updateAccounts
 {
  "apiUrl":"https://apisandbox-api.zuora.com/rest",
  "apiVersion":"v1",
  "apiAccessKeyId":"ZuoraTest@wso2.com",
  "apiSecretAccessKey":"ZuoraTest@wso2",
  "accountKey":"A00000836",
  "name":"Test New Account1",
  "billToContact": {
    "address1": "3400 Bridge Pkwy",
    "address2": "#000",
    "city": "Redwood City",
    "country": "United States",
    "county": "San Mateo",
    "fax": "+1(123)4567890",
    "firstName": "J",
    "homePhone": "+1(123)4567890",
    "lastName": "C",
    "mobilePhone": "+1(123)4567890",
    "nickname": "J",
    "otherPhone": "+1(123)4567890",
    "otherPhoneType": "Other",
    "personalEmail": "j.c@abc.com",
    "zipCode": "94000",
    "state": "CA",
    "taxRegion": "CA",
    "workEmail": "j.c@abc.com",
    "workPhone": "+1(123)4567890"
  },
  "soldToContact": {
    "address1": "3400 Bridge Pkwy",
    "address2": "#000",
    "city": "Redwood City",
    "country": "United States",
    "county": "San Mateo",
    "fax": "+1(123)4567890",
    "firstName": "J",
    "homePhone": "+1(123)4567890",
    "lastName": "C",
    "mobilePhone": "+1(123)4567890",
    "nickname": "J",
    "otherPhone": "+1(123)4567890",
    "otherPhoneType": "Other",
    "personalEmail": "j.c@abc.com",
    "zipCode": "94000",
    "state": "CA",
    "taxRegion": "CA",
    "workEmail": "j.c@abc.com",
    "workPhone": "+1(123)4567890"
  }
}
Related Zuora documentation

http://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Accounts/4_Update_account

Sample configuration

Following is a sample proxy service that illustrates how to connect to Zuora with the init operation and use the  createAccounts operation.The sample request for this proxy can be found in   createAccounts sample request   .

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="Zuora_Creat_Accounts"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="apiVersion" expression="json-eval($.apiVersion)"/>
         <property name="apiAccessKeyId" expression="json-eval($.apiAccessKeyId)"/>
         <property name="apiSecretAccessKey" expression="json-eval($.apiSecretAccessKey)"/>
         <property name="name" expression="json-eval($.name)"/>
         <property name="currency" expression="json-eval($.currency)"/>
         <property name="billCycleDay" expression="json-eval($.billCycleDay)"/>
         <property name="billToContact" expression="json-eval($.billToContact)"/>
         <property name="creditCard" expression="json-eval($.creditCard)"/>
         <property name="batch" expression="json-eval($.batch)"/>
         <zuora.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiVersion>{$ctx:apiVersion}</apiVersion>
            <apiAccessKeyId>{$ctx:apiAccessKeyId}</apiAccessKeyId>
            <apiSecretAccessKey>{$ctx:apiSecretAccessKey}</apiSecretAccessKey>
         </zuora.init>
         <zuora.createAccounts>
            <name>{$ctx:name}</name>
            <currency>{$ctx:currency}</currency>
            <creditCard>{$ctx:creditCard}</creditCard>
            <billCycleDay>{$ctx:billCycleDay}</billCycleDay>
            <billToContact>{$ctx:billToContact}</billToContact>
            <batch>{$ctx:batch}</batch>
         </zuora.createAccounts>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>