The article describes the Order Builder
zamend() method. The
zamend() method uses the Zuora amend() method to apply amendments to a single subscription.
Zuora.zApi.AmendResult zamend ( List<Zuora.zApi.AmendRequest> amendRequests)
zamend() method takes the following input parameter.
|amendRequest||List<Zuora.zApi.AmendRequest>||A list of the |
Only one subscription can be amended per call. Thus the method accepts only one
AmendRequest, which can contain the
Amendment objects up to the following:
- For WSDL versions 69+: Up to ten Amendment objects
- For WSDL versions 42.0 through 68: Up to three Amendment objects
- For WSDL versions 29.0 through 41.0: Only one Amendment object
AmendOptions is used to provide the parameter values for amend options for the amend() call. It includes the following properties.
|generateInvoice||Boolean||Set to |
|processPayments||Boolean||Set to |
|invoiceProcessingOptions||zApi.InvoiceProcessingOptions||Specifies whether, and how, an invoice should be generated for a new amendment.|
InvoiceProcessingOptions is used to provide the parameter values for the invoice processing options for the amend() call. It includes the following properties.
|invoiceTargetDate||String||Specifies a date for when an invoice should be generated.|
|invoiceDate||String||Specifies the date on which to generate the invoice. (WSDL 49.0+).|
zApi.PreviewOptions is used to provide the parameter values for the preview options for the amend() call. It includes the following properties.
|enablePreviewMode||Boolean||Specifies whether the call should create a subscription/amendment, or whether it should return a preview of the order.|
|numberOfPeriods||Integer||Specifies the number of periods to show in a preview.|
zamend() method returns a single
Zuora.zApi.AmendResult object that provides the results for the
Zuora.zApi.AmendResult has the following properties.
|amendmentIds||String||The ID of the Amendment objects.|
|errors||zObject||An array of errors indicating why the amend request may have failed.|
|invoiceDatas||zObject||A wrapper for an invoice and its line items. This field is returned only when settingPreviewMode for amend() to true.|
|InvoiceId||String||The system-generated Zuora invoice ID for the created Account.|
|paymentTransactionNumber||String||A payment transaction number associated with this amendment.|
|SubscriptionId||String||Id of the subscription.|
|success||Boolean||Indicates whether the amend request succeeded (true) or did not succeed (false).|
zamend() method uses the following exception classes to catch an exception when an error occurs in the call:
See the sample code at Github that demonstrates using the Order Builder
zApi.zAmend() call to implement the following use cases:
- Create an "Add New Product" amendment. Add a product rate plan that has two charges: a one-time charge and a monthly recurring charge.
- Preview the invoice for the next two months.