Skip to main content

Create Multiple Subscriptions and Issue a Single Payment from a Quote

Zuora

Create Multiple Subscriptions and Issue a Single Payment from a Quote

You can use a single quote to create multiple subscriptions and issue a single payment based on that quote. This feature is supported through global methods only. 

Using Parent and Child Quotes

A quote can have child quotes.

  • A quote that has child quotes is referred to as a parent quote. 
    • A parent quote can have multiple sub-quotes.
    • Products cannot be added to a parent quote. 
  • A child quote is referred to as a sub-quote.
    • One or more products can be added to a sub-quote.
    • The sub-quotes use the zqu__ParentQuote__c field to link to the parent quote. 

When a parent quote is sent to Zuora via the sendToZBilling global method, a subscription or a list of amendments will be created for each sub-quote.

Configuring the Parent Quote Attributes

Parent quotes include two attributes to support this feature: 

  • Generate Invoice (zqu__GenerateInvoice__c): Use this attribute to specify whether to generate an invoice for the sub-quotes. 
  • Invoice Processing Option (zqu__InvoiceProcessingOption__c): Use this attribute to specify whether to generate an invoice for a sub-quote at the Account level or the Subscription level.
  • Apply Credit Balance (zqu__ApplyCreditBalance__c): Use this attribute to specify whether to apply any credit balance on the customer's account to invoices for sub-quotes.

Quote Validation Rules

Parent quotes are subject to the following validation rules when being sent to Zuora via the global method:

  • The value of zqu__Status__c must be New.
  • The parent quote cannot be a child of another quote, i.e. a parent quote's zqu__ParentQuote__c field must be null.
  • The parent quote must have at least two sub-quotes. The sub-quotes can be a mix of subscriptions, amendments, and renewals.
  • When two or more of the sub-quotes are amendment quotes, all of the amendment quotes must refer to different subscriptions. The same subscription cannot be amended by two different sub-quotes.

How the Parent Quote Values Affect the Sub-quotes

Although the two invoice-related attributes are enabled on all quotes, if a quote is a sub-quote, the values specified on its parent quote will take effect.

Generate Invoice value on Parent Quote Invoice Processing Option value on Parent Quote Description
true Account

The sub-quotes will be processed to generate subscriptions or amendments. Zuora 360 will generate a single invoice. 

Zuora 360 will process all of the sub-quotes, even if exceptions are generated for some of the sub-quotes. The exceptions will be sent back to the customer and the invoice will not be generated.

The subscriptions generated will write the Subscription ID back to the sub-quotes. The Invoice ID and Payment ID will be written back to the parent quotes.

One parent quote will create one new billing account if its sub-quotes are of type New Subscription.

true Subscription

The sub-quotes will generate subscriptions or amendments and invoices separately.

The Invoice ID and Payment ID will be written back to the sub-quotes.

One parent quote will create one new billing account if its sub-quotes are type New Subscription.

false (none) Zuora 360 will not generate invoices for either the parent quote or sub-quotes. 

Processing Quotes Sent to Zuora

All requests to send parent quotes to Zuora will be handled asynchronously. This means that the requests will be sent from Salesforce, but the results will not be immediately written back to the Salesforce records. Zuora Quotes writes the results to Salesforce when it completes the processing of the requests.

Sample Code

/* 
    PRE-CONDITIONS:
    - the quote referenced by primaryQuoteId (the parent quote) has its zqu__Is_Parent_Quote__c field set to true.
    - at least two "standard" subscription, amendment, or renewal quotes are set to be children of the parent quote
*/

Id primaryQuoteId = 'a0GE0000005HRhD';
zqu__Quote__c primaryQuote = [select Id,zqu__GenerateInvoice__c,zqu__InvoiceProcessingOption__c from zqu__Quote__c where Id = :primaryQuoteId];

// construct the wrapper objects to pass to the global method
// NOTE: the wrapper collection for a parent quote should contain only the parent quote in the quoteRequests property
List<zqu.zQuoteUtil.ZBillingQuoteCollection> qCollections = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();

zqu.zQuoteUtil.ZBillingQuoteCollection qCollection = new zqu.zQuoteUtil.ZBillingQuoteCollection();
qCollection.zAccountId = 'new';
qCollection.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();

zqu.zQuoteUtil.ZBillingQuoteRequest qRequest = new zqu.zQuoteUtil.ZBillingQuoteRequest();
qRequest.generateInvoice = primaryQuote.zqu__GenerateInvoice__c;
qRequest.invoiceProcessingOption = primaryQuote.zqu__InvoiceProcessingOption__c;
qRequest.sfdcQuoteId = primaryQuote.Id;

qCollection.quoteRequests.add(qRequest);
qCollections.add(qCollection);

// pass the wrapper objects into the global method
List<zqu.zQuoteUtil.ZBillingResult> results = zqu.zQuoteUtil.sendToZBilling(qCollections);

// ... operate on the results collection ...