Invoke the subscribe Call
To invoke the subscribe() call, begin by populating all of the data (account, contact, payment method), then call subscribe().
Using the subscribe() Call
To use the subscribe() call:
- Populate all of the required fields for the Account object.
- Populate all of the required fields for the Contact object to be used as the BillTo.
- Populate all of the required fields for the Contact object to be used as the SoldTo. If this is not set, the BillTo will also be used as the SoldTo contact.
- Populate all of the required fields for the PaymentMethod object.
- Populate all of the required fields for the SubscriptionData object. This includes the following tasks:
- Populate all of the required fields for the Subscription object.
- Populate all of the required fields for the RatePlan object. Use a valid ID for
ProductRatePlanId
. - Populate all of the required fields for the RatePlanCharge objects:
- For WSDL v1-v10: use a valid ID for ProductRatePlanChargeId. If no RatePlanCharge objects are passed, the default RatePlanCharges will copied from the RatePlan object whose ID is passed in the RatePlan object in step 5.2.
- For WSDL v11+: Pass in a valid RatePlanChargeData object. If you do not pass RatePlanChargeData objects, the default RatePlanCharges will copied from the RatePlan object whose ID was passed in the RatePlan object.
- Create a SubscribeRequest object. Set all of the objects created in the previous steps.
- Call the subscribe() method, passing in the SubscribeRequest object and the SessionHeader object returned by the login() call.
- Zuora returns a SubscribeResponse object. Get the SubscribeResult object from the returned response object and check for the value of the success field.
- If the success value is true, read the other values returned in the SubscribeResult such as the
AccountId
,AccountNumber
,SubscriptionId
,SubscriptionNumber
,InvoiceNumber
,PaymentTransactionNumber
. - If the success value is false, then process the errors by getting the Code and Message from the error objects.
- If the success value is true, read the other values returned in the SubscribeResult such as the
Sample Code
Calling subscribe () for a New Account
<ns1:subscribe> <ns1:subscribes> <!-- Option 1: Subscribe call that creates an account, contacts and payment method. --> <ns1:Account xsi:type="ns2:Account"> <ns2:AccountNumber></ns2:AccountNumber> <ns2:AutoPay>true</ns2:AutoPay> <ns2:Batch>Batch1</ns2:Batch> <ns2:BcdSettingOption>AutoSet</ns2:BcdSettingOption> <ns2:BillCycleDay>0</ns2:BillCycleDay> <ns2:Currency>USD</ns2:Currency> <ns2:Name>Account from API subscribe 3</ns2:Name> <ns2:PaymentGateway>Test Gateway</ns2:PaymentGateway> <ns2:PaymentTerm>Due Upon Receipt</ns2:PaymentTerm> <ns2:CommunicationProfileId>2c92c0f852f2ebec0152f4b12284551e</ns2:CommunicationProfileId> <ns2:InvoiceDeliveryPrefsEmail>true</ns2:InvoiceDeliveryPrefsEmail> <ns2:InvoiceDeliveryPrefsPrint>true</ns2:InvoiceDeliveryPrefsPrint> <ns2:InvoiceTemplateId>2c92c0f952a680540152a935aeff57b4</ns2:InvoiceTemplateId> </ns1:Account> <ns1:PaymentMethod xsi:type="ns2:PaymentMethod"> <ns2:Id>2c92c0f953131e1f015333e63a414bb2</ns2:Id> </ns1:PaymentMethod> <ns1:BillToContact xsi:type="ns2:Contact"> <ns2:Address1>100 Main Street</ns2:Address1> <ns2:City>Detroit</ns2:City> <ns2:Country>United States</ns2:Country> <ns2:FirstName>John</ns2:FirstName> <ns2:LastName>Jones</ns2:LastName> <ns2:PostalCode>48205</ns2:PostalCode> <ns2:State>MI</ns2:State> <ns2:WorkEmail>test@zzztest.com</ns2:WorkEmail> <ns2:WorkPhone>5555555555</ns2:WorkPhone> </ns1:BillToContact> <ns1:PreviewOptions> <ns1:EnablePreviewMode>false</ns1:EnablePreviewMode> <ns1:NumberOfPeriods>1</ns1:NumberOfPeriods> </ns1:PreviewOptions> <ns1:SoldToContact xsi:type="ns2:Contact"> <ns2:Address1>100 Main Street</ns2:Address1> <ns2:City>Detroit</ns2:City> <ns2:Country>United States</ns2:Country> <ns2:FirstName>John</ns2:FirstName> <ns2:LastName>Jones</ns2:LastName> <ns2:PostalCode>48205</ns2:PostalCode> <ns2:State>MI</ns2:State> <ns2:WorkEmail>test@zzztest.com</ns2:WorkEmail> <ns2:WorkPhone>5555555555</ns2:WorkPhone> </ns1:SoldToContact> <!-- End of Option 1 --> <ns1:SubscribeOptions> <ns1:GenerateInvoice>false</ns1:GenerateInvoice> <ns1:ProcessPayments>false</ns1:ProcessPayments> </ns1:SubscribeOptions> <ns1:SubscriptionData> <ns1:Subscription xsi:type="ns2:Subscription"> <ns2:AutoRenew>true</ns2:AutoRenew> <ns2:ContractEffectiveDate>2016-02-26</ns2:ContractEffectiveDate> <ns2:InitialTerm>12</ns2:InitialTerm> <ns2:Name></ns2:Name> <ns2:RenewalTerm>12</ns2:RenewalTerm> <ns2:ServiceActivationDate>2016-02-26</ns2:ServiceActivationDate> <ns2:TermStartDate>2016-02-26</ns2:TermStartDate> <ns2:TermType>TERMED</ns2:TermType> </ns1:Subscription> <ns1:RatePlanData> <ns1:RatePlan xsi:type="ns2:RatePlan"> <ns2:ProductRatePlanId>2c92c0f9518a922b01518da5ceca173b</ns2:ProductRatePlanId> </ns1:RatePlan> <ns1:RatePlanChargeData> <ns1:RatePlanCharge xsi:type="ns2:RatePlanCharge"> <ns2:ProductRatePlanChargeId>2c92c0f94468a922b01518da5cf10173d</ns2:ProductRatePlanChargeId> <ns2:Quantity>5</ns2:Quantity> </ns1:RatePlanCharge> </ns1:RatePlanChargeData> </ns1:RatePlanData> </ns1:SubscriptionData> </ns1:subscribes> </ns1:subscribe>
Calling subscribe() for an Existing Account
<!-- sample subscribe call for an account that already exists --> <!-- Valid for version 11.0+ of the Zuora WSDL --> <ns1:subscribe> <ns1:subscribes> <ns1:Account> <!-- Set ID to the Account you want to create a subscription for--> <ns2:Id></ns2:Id> </ns1:Account> <ns1:SubscribeOptions> <ns1:GenerateInvoice>true</ns1:GenerateInvoice> <ns1:ProcessPayments>true</ns1:ProcessPayments> </ns1:SubscribeOptions> <ns1:SubscriptionData> <ns1:Subscription> <ns2:AutoRenew>true</ns2:AutoRenew> <!-- See Working With Dates - All datetimes are converted to GMT-08:00 --> <ns2:ContractAcceptanceDate>2009-07-03</ns2:ContractAcceptanceDate> <ns2:ContractEffectiveDate>2009-07-03</ns2:ContractEffectiveDate> <ns2:InitialTerm>12</ns2:InitialTerm> <ns2:Name>A-S00000020090703080755</ns2:Name> <ns2:RenewalTerm>12</ns2:RenewalTerm> <ns2:ServiceActivationDate>2009-07-03</ns2:ServiceActivationDate> <ns2:TermStartDate>2009-07-03</ns2:TermStartDate> </ns1:Subscription> <ns1:RatePlanData> <ns1:RatePlan xsi:type="ns1:RatePlan"> <!-- Set ID to the ProductRatePlan you want to subscribe to --> <ns2:ProductRatePlanId></ns2:ProductRatePlanId> </ns1:RatePlan> <!-- example of how to set quantity of with RatePlanChargeData --> <ns1:RatePlanChargeData> <ns1:RatePlanCharge xsi:type="ns1:RatePlanCharge"> <!-- Set ID to the ProductRatePlan you want to subscribe to, and specify any other information you want to override or set- like quantity, charge number, etc --> <ns2:ProductRatePlanChargeId></ns2:ProductRatePlanChargeId> <ns2:Quantity>19</ns2:Quantity> </ns1:RatePlanCharge> </ns1:RatePlanChargeData> </ns1:RatePlanData> </ns1:SubscriptionData> </ns1:subscribes> </ns1:subscribe>
Notes and limitations
This call does not work when the Invoice Settlement feature is enabled in your tenant.