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 Subscriptions in Zuora

Overview

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

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

OperationDescription

getSubscriptions

 Retrieve all subscriptions associated with the specified account

getSubscriptionsByKey

Retrieve detailed information about a specified subscription

createSubscription

Create a new subscription

renewSubscriptions

Renew a termed subscription

previewSubscription

Create a new subscription in preview mode

Operation details

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

Get Subscriptions

The getSubscriptions operation marks a parent object as completed.

getSubscriptions
<zuora.getSubscriptions>
    <accountKey>{$ctx:accountKey}</accountKey>
    <pageSize>{$ctx:pageSize}</pageSize>
    <chargeDetail>{$ctx:chargeDetail}</chargeDetail>
</zuora.getSubscriptions>
Properties
  • accountKey : Required -The account number or account ID.

  • pageSize: Number of rows to return.
  • chargeDetail: The segmented rate plan charges.

Sample request

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

Sample Request for getSubscriptions
{
 "apiUrl":"https://apisandbox-api.zuora.com/rest",
 "apiVersion":"v1",
 "apiAccessKeyId":"ZuoraTest@wso2.com",
 "apiSecretAccessKey":"ZuoraTest@wso2",
 "accountKey":"	A00000685",
  "pageSize":"2",
  "chargeDetail":"last-segment"
}	
Related Zuora documentation

https://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Subscriptions/4_Get_subscriptions_by_account

Get Subscriptions By Key

The getSubscriptionsByKey operation retrieves detailed information about a specified subscription.

createDiscussion
<zuora.getSubscriptionsByKey>
    <accountKey>{$ctx:accountKey}</accountKey>
    <subscriptionKey>{$ctx:subscriptionKey}</subscriptionKey>
    <chargeDetail>{$ctx:chargeDetail}</chargeDetail>
</zuora.getSubscriptionsByKey> 
Properties
  • accountKey : Required -The account number or account ID.

  • subscriptionKey : Subscription number.

  • chargeDetail: The segmented rate plan charges.
Sample request

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

Sample Request for getSubscriptionsByKey
{
 "apiUrl":"https://apisandbox-api.zuora.com/rest",
 "apiVersion":"v1",
 "apiAccessKeyId":"ZuoraTest@wso2.com",
 "apiSecretAccessKey":"ZuoraTest@wso2",
 "accountKey":"	A00000685",
  "subscriptionKey":"5677899000677",
  "chargeDetail":"last-segment"
}
Related Zuora documentation

https://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Subscriptions/Get_subscriptions_by_key

Creating a discussion

The createSubscription operation creates a new subscription.

createSubscription
<zuora.createSubscription>
    <accountKey>{$ctx:accountKey}</accountKey>
    <termType>{$ctx:termType}</termType>
    <contractEffectiveDate>{$ctx:contractEffectiveDate}</contractEffectiveDate>
    <subscribeToRatePlans>{$ctx:subscribeToRatePlans}</subscribeToRatePlans>
    <invoiceOwnerAccountKey>{$ctx:invoiceOwnerAccountKey}</invoiceOwnerAccountKey>
    <serviceActivationDate>{$ctx:serviceActivationDate}</serviceActivationDate>
    <customerAcceptanceDate>{$ctx:customerAcceptanceDate}</customerAcceptanceDate>
    <termStartDate>{$ctx:termStartDate}</termStartDate>
    <initialTerm>{$ctx:initialTerm}</initialTerm>
    <initialTermPeriodType>{$ctx:initialTermPeriodType}</initialTermPeriodType>
    <notes>{$ctx:notes}</notes>
    <invoiceTargetDate>{$ctx:invoiceTargetDate}</invoiceTargetDate>
    <invoiceSeparately>{$ctx:invoiceSeparately}</invoiceSeparately>
    <previewType>{$ctx:previewType}</previewType>
    <includeExistingDraftInvoiceItems>{$ctx:includeExistingDraftInvoiceItems}</includeExistingDraftInvoiceItems>
</zuora.createSubscription> 
Properties
  • accountKey : Required - The account number or account ID.

  • termType: Required - Possible values are: TERMED, EVERGREEN.

  • contractEffectiveDate : Required - Effective contract date for this subscription, as yyyy-mm-dd.

  • subscribeToRatePlans : Container for one or more rate plans for this subscription.

  • invoiceOwnerAccountKey : Invoice owner account number or ID.

  • serviceActivationDate : The date on which the services or products within a subscription have been activated and access has been provided to the customer.

  • customerAcceptanceDate: The date on which the services or products within a subscription have been accepted by the customer, as yyyy-mm-dd.
  • termStartDate: The date on which the subscription term begins, as yyyy-mm-dd. If this is a renewal subscription, this date is different from the subscription start date.
  • initialTerm : The length of the period for the first subscription term.
  • initialTermPeriodType : The period type for the first subscription term.
  • autoRenew : If true, this subscription automatically renews at the end of the subscription term. 
  • renewalTerm : The length of the period for the subscription renewal term.
  • renewalTermPeriodType : The period type for the subscription renewal term.
  • renewalSetting : Specifies whether a termed subscription will remain termed or change to evergreen when it is renewed.
  • notes : String of up to 500 characters.
  • 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: Collects an automatic payment for a subscription. The collection generated in this operation is only for this subscription, not for the entire customer account.
  • invoiceSeparately Separates a single subscription from other subscriptions and invoices the charge independently. 
  • applyCreditBalance: Applies a credit balance to an invoice.
  • invoiceTargetDate: Date through which to calculate charges if an invoice is generated, as yyyy-mm-dd. Default is current date.
  • OpportunityCloseDateQT: The closing date of the Opportunity.

  • OpportunityNameQT: The unique identifier of the Opportunity. 

  • QuoteBusinessTypeQT: The specific identifier for the type of business transaction the Quote represents such as New, Upsell, Downsell, Renewal, or Churn.

  • QuoteNumberQT: The unique identifier of the Quote.

  • QuoteTypeQT: The Quote type that represents the subscription lifecycle stage such as New, Amendment, Renew or Cancel.

  • cfTxtnC: One or more optional custom fields.

  • cfPknC : One or more optional custom fields.

Sample request

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

Sample Request for createSubscription
{
 "apiUrl":"https://apisandbox-api.zuora.com/rest",
 "apiVersion":"v1",
 "apiAccessKeyId":"ZuoraTest@wso2.com",
 "apiSecretAccessKey":"ZuoraTest@wso2",
 "accountKey":"	A00000685",
  
  "termType": "TERMED",
  "invoiceTargetDate": "2013-12-31",
  "contractEffectiveDate": "2013-1-15",
 
  "subscribeToRatePlans":
    [{"chargeOverrides":
       [{"productRatePlanChargeId": "ff8080811ca15d19011cddad8c953b53",
         "quantity": 100}],
      "productRatePlanId": "ff8080811ca15d19011cdda9b0ad3b51"}],
    "initialTerm": 12,
  "initialTermPeriodType": "Week"
}
Related Zuora documentation

https://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Subscriptions/02_Create_subscription

Renew Subscriptions 

The renewSubscriptions operation renews a termed subscription.

renewSubscriptions
<zuora.renewSubscriptions>
    <subscriptionKey>{$ctx:subscriptionKey}</subscriptionKey>
    <invoiceCollect>{$ctx:invoiceCollect}</invoiceCollect>
    <chargeDetail>{$ctx:chargeDetail}</chargeDetail>
</zuora.renewSubscriptions> 
Properties
  • subscriptionKey: Required - The ID of the project.
  • invoiceCollect: The discussion topic.
  • chargeDetail: The first message body.
Sample request

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

Sample Request for renewSubscriptions
{
	"apiToken":"1-a19D7TjISNblfRU7kyWdEkTdzNlM6LC6BAywjH52",
	"apiUrl":"https://dconnectors.manageprojects.com",
	"format":"json",
	"projectId":"43",
	"name":"New Discussion about the Performance",
	"discussionBody":"This is the discussion body",
	"categoryId":"63",
	"visibility":"1"
}
Related Zuora documentation

https://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Subscriptions/6_Renew_Subscription

Preview Subscription

The previewSubscription operation adds a new discussion.

previewSubscription
<zuora.previewSubscription>
    <accountKey>{$ctx:accountKey}</accountKey>
    <termType>{$ctx:termType}</termType>
    <contractEffectiveDate>{$ctx:contractEffectiveDate}</contractEffectiveDate>
    <subscribeToRatePlans>{$ctx:subscribeToRatePlans}</subscribeToRatePlans>
    <invoiceOwnerAccountKey>{$ctx:invoiceOwnerAccountKey}</invoiceOwnerAccountKey>
    <serviceActivationDate>{$ctx:serviceActivationDate}</serviceActivationDate>
    <customerAcceptanceDate>{$ctx:customerAcceptanceDate}</customerAcceptanceDate>
    <termStartDate>{$ctx:termStartDate}</termStartDate>
    <initialTerm>{$ctx:initialTerm}</initialTerm>
    <initialTermPeriodType>{$ctx:initialTermPeriodType}</initialTermPeriodType>
    <notes>{$ctx:notes}</notes>
    <invoiceCollect>{$ctx:invoiceCollect}</invoiceCollect>
    <invoiceTargetDate>{$ctx:invoiceTargetDate}</invoiceTargetDate>
    <invoiceSeparately>{$ctx:invoiceSeparately}</invoiceSeparately>
    <previewType>{$ctx:previewType}</previewType>
    <includeExistingDraftInvoiceItems>{$ctx:includeExistingDraftInvoiceItems}</includeExistingDraftInvoiceItems>
</zuora.previewSubscription> 
Properties
  • accountKey: Required - The account number or account ID.

  • termType: Required - Possible values are: TERMED, EVERGREEN.

  • contractEffectiveDate: Required - Effective contract date for this subscription, as yyyy-mm-dd.

  • subscribeToRatePlans: Container for one or more rate plans for this subscription.

  • invoiceOwnerAccountKey: Invoice owner account number or ID.

  • serviceActivationDate: The date on which the services or products within a subscription have been activated and access has been provided to the customer.

  • customerAcceptanceDate: The date on which the services or products within a subscription have been accepted by the customer, as yyyy-mm-dd.

  • termStartDate: The date on which the subscription term begins, as yyyy-mm-dd. If this is a renewal subscription, this date is different from the subscription start date.
  • initialTerm The length of the period for the first subscription term.
  • initialTermPeriodType : The period type for the first subscription term.
  • notes : String of up to 500 characters.
  • invoiceCollect: Creates and collects an invoice for a subscription. The invoice generated in this operation is only for this subscription, not for the entire customer account.
  • invoiceSeparately Separates a single subscription from other subscriptions and invoices the charge independently. 
  • applyCreditBalance: Applies a credit balance to an invoice.
  • invoiceTargetDate: Date through which to calculate charges if an invoice is generated, as yyyy-mm-dd. Default is current date.

Sample request

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

Sample Request for previewSubscription
{
 "apiUrl":"https://apisandbox-api.zuora.com/rest",
 "apiVersion":"v1",
 "apiAccessKeyId":"ZuoraTest@wso2.com",
 "apiSecretAccessKey":"ZuoraTest@wso2",
 "accountKey":"	A00000669",
  
  "termType": "TERMED",
  "invoiceTargetDate": "2013-12-31",
  "contractEffectiveDate": "2013-1-15",
 
  "subscribeToRatePlans":
    [{"chargeOverrides":
       [{"productRatePlanChargeId": "ff8080811ca15d19011cddad8c953b53",
         "quantity": 100}],
      "productRatePlanId": "ff8080811ca15d19011cdda9b0ad3b51"}],
    "initialTerm": 12,
  "initialTermPeriodType": "Week"
}
Related Zuora documentation

https://knowledgecenter.zuora.com/BC_Developers/REST_API/B_REST_API_reference/Subscriptions/01_Preview_subscription

Sample configuration

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

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="zuora_getSubscriptions"
       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="accountKey" expression="json-eval($.accountKey)"/>
            <property name="pageSize" expression="json-eval($.pageSize)"/>
            <property name="chargeDetail" expression="json-eval($.chargeDetail)"/>
            <zuora.init>
                <apiUrl>{$ctx:apiUrl}</apiUrl>
                <apiVersion>{$ctx:apiVersion}</apiVersion>
                <apiAccessKeyId>{$ctx:apiAccessKeyId}</apiAccessKeyId>
                <apiSecretAccessKey>{$ctx:apiSecretAccessKey}</apiSecretAccessKey>
            </zuora.init>
            <zuora.getSubscriptions>
                <accountKey>{$ctx:accountKey}</accountKey>
                <pageSize>{$ctx:pageSize}</pageSize>
                <chargeDetail>{$ctx:chargeDetail}</chargeDetail>
            </zuora.getSubscriptions>
            <respond/>
        </inSequence>
    </target>
    <description/>
</proxy>