Re: Troubleshooting - Invoices created separately using SOAP subscribe() call

Reply
theinrich Valued Scholar

Valued Scholar

Valued Scholar
Posts: 8
Registered: ‎11-30-2016
Accepted Solution

Troubleshooting - Invoices created separately using SOAP subscribe() call

[ Edited ]

Hello.

 

We're experiencing a bit of an issue while using the SOAP API.

 

1) What we're trying to achieve: we want to be able to create multiple subscriptions using a single subscribe() call and all the subscriptions created should share the same invoice.

 

2) What we're doing: we are using a single subscribe() call that contains multiple SubscribeRequests, one for each individual subscription. Each of the requests contains the same Account, which was created before and has it's ID set. No SubscribeOptions are transmitted. The SubscriptionData simply contains the Subscription and the RatePlanData is simply a list containing the different rate plans. A typical request looks like this:

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://object.api.zuora.com/" xmlns:ns2="http://api.zuora.com/">
<SOAP-ENV:Header>
    <ns2:SessionHeader>
        <ns2:session>X</ns2:session>
    </ns2:SessionHeader>
    <ns2:SessionHeader>
        <ns2:session>X</ns2:session>
    </ns2:SessionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
    <ns2:subscribe>
        <ns2:subscribes>
            <ns2:Account>
                <ns1:Id>2c92c0f958aa45600158b4aea9843239</ns1:Id>
                <ns1:AutoPay>true</ns1:AutoPay>
                <ns1:Batch>Batch1</ns1:Batch>
                <ns1:BillCycleDay>30</ns1:BillCycleDay>
                <ns1:BillToId>2c92c0f958aa45600158b4aeab0c323b</ns1:BillToId>
                <ns1:CommunicationProfileId>2c92c0f9578d5b3c0157907ace8e05cc</ns1:CommunicationProfileId>
                <ns1:Currency>GBP</ns1:Currency>
                <ns1:DefaultPaymentMethodId>2c92c0f958aa45600158b4ae75d23217</ns1:DefaultPaymentMethodId>
                <ns1:InvoiceDeliveryPrefsEmail>true</ns1:InvoiceDeliveryPrefsEmail>
                <ns1:Name>trivago GmbH</ns1:Name>
                <ns1:ParentId>2c92c0f858769ae10158782ac928181a</ns1:ParentId>
                <ns1:PaymentTerm>Due Upon Receipt</ns1:PaymentTerm>
                <ns1:SoldToId>2c92c0f958aa45600158b4aeab0c323b</ns1:SoldToId>
                <ns1:Status>Active</ns1:Status>
                <ns1:thm_account_id__c>1</ns1:thm_account_id__c>
                <ns1:thm_account_type__c>PRO</ns1:thm_account_type__c>
                <ns1:thm_billing_cycle__c>monthly</ns1:thm_billing_cycle__c>
            </ns2:Account>
            <ns2:SubscriptionData>
                <ns2:Subscription>
                    <ns1:AutoRenew>true</ns1:AutoRenew>
                    <ns1:ContractAcceptanceDate>2016-11-30</ns1:ContractAcceptanceDate>
                    <ns1:ContractEffectiveDate>2016-11-30</ns1:ContractEffectiveDate>
                    <ns1:InitialTerm>1</ns1:InitialTerm>
                    <ns1:Notes>Traube am See</ns1:Notes>
                    <ns1:RenewalTerm>1</ns1:RenewalTerm>
                    <ns1:ServiceActivationDate>2016-11-30</ns1:ServiceActivationDate>
                    <ns1:Status>Active</ns1:Status>
                    <ns1:TermStartDate>2016-11-30</ns1:TermStartDate>
                    <ns1:thm_item_id__c>5004</ns1:thm_item_id__c>
                </ns2:Subscription>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f95819b30d0158263d878f51b3</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f957ae0d300157afd357f66008</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
            </ns2:SubscriptionData>
        </ns2:subscribes>
        <ns2:subscribes>
            <ns2:Account>
                <ns1:Id>2c92c0f958aa45600158b4aea9843239</ns1:Id>
                <ns1:AutoPay>true</ns1:AutoPay>
                <ns1:Batch>Batch1</ns1:Batch>
                <ns1:BillCycleDay>30</ns1:BillCycleDay>
                <ns1:BillToId>2c92c0f958aa45600158b4aeab0c323b</ns1:BillToId>
                <ns1:CommunicationProfileId>2c92c0f9578d5b3c0157907ace8e05cc</ns1:CommunicationProfileId>
                <ns1:Currency>GBP</ns1:Currency>
                <ns1:DefaultPaymentMethodId>2c92c0f958aa45600158b4ae75d23217</ns1:DefaultPaymentMethodId>
                <ns1:InvoiceDeliveryPrefsEmail>true</ns1:InvoiceDeliveryPrefsEmail>
                <ns1:Name>trivago GmbH</ns1:Name>
                <ns1:ParentId>2c92c0f858769ae10158782ac928181a</ns1:ParentId>
                <ns1:PaymentTerm>Due Upon Receipt</ns1:PaymentTerm>
                <ns1:SoldToId>2c92c0f958aa45600158b4aeab0c323b</ns1:SoldToId>
                <ns1:Status>Active</ns1:Status>
                <ns1:thm_account_id__c>1</ns1:thm_account_id__c>
                <ns1:thm_account_type__c>PRO</ns1:thm_account_type__c>
                <ns1:thm_billing_cycle__c>monthly</ns1:thm_billing_cycle__c>
            </ns2:Account>
            <ns2:SubscriptionData>
                <ns2:Subscription>
                    <ns1:AutoRenew>true</ns1:AutoRenew>
                    <ns1:ContractAcceptanceDate>2016-11-30</ns1:ContractAcceptanceDate>
                    <ns1:ContractEffectiveDate>2016-11-30</ns1:ContractEffectiveDate>
                    <ns1:InitialTerm>1</ns1:InitialTerm>
                    <ns1:Notes>Iberostar Ciudad Blanca</ns1:Notes>
                    <ns1:RenewalTerm>1</ns1:RenewalTerm>
                    <ns1:ServiceActivationDate>2016-11-30</ns1:ServiceActivationDate>
                    <ns1:Status>Active</ns1:Status>
                    <ns1:TermStartDate>2016-11-30</ns1:TermStartDate>
                    <ns1:thm_item_id__c>6707</ns1:thm_item_id__c>
                </ns2:Subscription>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f95819b2f80158263a4cf73f58</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f957ae0d300157afd357f66008</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
            </ns2:SubscriptionData>
        </ns2:subscribes>
    </ns2:subscribe>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The SubscribeResult then contains a different InvoiceId and InvoiceNumber for each of the subscriptions, which is something we want to avoid.

 

 

3) What else we tried: there's seems to be a number of options available to influence this behaviour. We tried setting the IsInvoiceSeparate field of the Subscription to false explicitly, didn't help. We tried an option in the back office tool as it is described in this article, it didn't help either.

 

It would be great to know if we're doing something wrong or if this is actually not possible.

Thanks in advance. 

 

Viktor Zuora Moderator

Zuora Moderator

Zuora Moderator
Posts: 238
Registered: ‎01-11-2016

Re: Troubleshooting - Invoices created separately using SOAP subscribe() call

Thanks for reporting this @theinrich , I'll do some testing on my Sandbox and will let you know my findings!



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted
Viktor Zuora Moderator

Zuora Moderator

Zuora Moderator
Posts: 238
Registered: ‎01-11-2016

Re: Troubleshooting - Invoices created separately using SOAP subscribe() call

[ Edited ]

@theinrich I have edited out the session tokens from your examples, as it's not secure to include these in the post.

 

I've done some tests and found a way for you to generate multiple subscriptions with the same invoice.

 

The trick is to add the SubscribeOptions complex type and set the GenerateInvoice field to false for all the subscriptions included in the call, except for the last one, where it should be set to true - then all your subscriptions will be included on the same invoice.

 

Using your call as a template, here's what it should look like, let me know if this works for you!

 

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://object.api.zuora.com/" xmlns:ns2="http://api.zuora.com/">
<SOAP-ENV:Header>
    <ns2:SessionHeader>
        <ns2:session>X</ns2:SessionHeader>
    <ns2:SessionHeader>
        <ns2:session>X</ns2:session>
    </ns2:SessionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
    <ns2:subscribe>
        <ns2:subscribes>
            <ns2:Account>
                <ns1:Id>2c92c0f958aa45600158b4aea9843239</ns1:Id>
                <ns1:AutoPay>true</ns1:AutoPay>
                <ns1:Batch>Batch1</ns1:Batch>
                <ns1:BillCycleDay>30</ns1:BillCycleDay>
                <ns1:BillToId>2c92c0f958aa45600158b4aeab0c323b</ns1:BillToId>
                <ns1:CommunicationProfileId>2c92c0f9578d5b3c0157907ace8e05cc</ns1:CommunicationProfileId>
                <ns1:Currency>GBP</ns1:Currency>
                <ns1:DefaultPaymentMethodId>2c92c0f958aa45600158b4ae75d23217</ns1:DefaultPaymentMethodId>
                <ns1:InvoiceDeliveryPrefsEmail>true</ns1:InvoiceDeliveryPrefsEmail>
                <ns1:Name>trivago GmbH</ns1:Name>
                <ns1:ParentId>2c92c0f858769ae10158782ac928181a</ns1:ParentId>
                <ns1:PaymentTerm>Due Upon Receipt</ns1:PaymentTerm>
                <ns1:SoldToId>2c92c0f958aa45600158b4aeab0c323b</ns1:SoldToId>
                <ns1:Status>Active</ns1:Status>
                <ns1:thm_account_id__c>1</ns1:thm_account_id__c>
                <ns1:thm_account_type__c>PRO</ns1:thm_account_type__c>
                <ns1:thm_billing_cycle__c>monthly</ns1:thm_billing_cycle__c>
            </ns2:Account>
			<ns2:SubscribeOptions>
				<ns2:GenerateInvoice>false</ns2:GenerateInvoice>
				<ns2:ProcessPayments>false</ns2:ProcessPayments>
			</ns2:SubscribeOptions>
            <ns2:SubscriptionData>
                <ns2:Subscription>
                    <ns1:AutoRenew>true</ns1:AutoRenew>
                    <ns1:ContractAcceptanceDate>2016-11-30</ns1:ContractAcceptanceDate>
                    <ns1:ContractEffectiveDate>2016-11-30</ns1:ContractEffectiveDate>
                    <ns1:InitialTerm>1</ns1:InitialTerm>
                    <ns1:Notes>Traube am See</ns1:Notes>
                    <ns1:RenewalTerm>1</ns1:RenewalTerm>
                    <ns1:ServiceActivationDate>2016-11-30</ns1:ServiceActivationDate>
                    <ns1:Status>Active</ns1:Status>
                    <ns1:TermStartDate>2016-11-30</ns1:TermStartDate>
                    <ns1:thm_item_id__c>5004</ns1:thm_item_id__c>
                </ns2:Subscription>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f95819b30d0158263d878f51b3</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f957ae0d300157afd357f66008</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
            </ns2:SubscriptionData>
        </ns2:subscribes>
        <ns2:subscribes>
            <ns2:Account>
                <ns1:Id>2c92c0f958aa45600158b4aea9843239</ns1:Id>
                <ns1:AutoPay>true</ns1:AutoPay>
                <ns1:Batch>Batch1</ns1:Batch>
                <ns1:BillCycleDay>30</ns1:BillCycleDay>
                <ns1:BillToId>2c92c0f958aa45600158b4aeab0c323b</ns1:BillToId>
                <ns1:CommunicationProfileId>2c92c0f9578d5b3c0157907ace8e05cc</ns1:CommunicationProfileId>
                <ns1:Currency>GBP</ns1:Currency>
                <ns1:DefaultPaymentMethodId>2c92c0f958aa45600158b4ae75d23217</ns1:DefaultPaymentMethodId>
                <ns1:InvoiceDeliveryPrefsEmail>true</ns1:InvoiceDeliveryPrefsEmail>
                <ns1:Name>trivago GmbH</ns1:Name>
                <ns1:ParentId>2c92c0f858769ae10158782ac928181a</ns1:ParentId>
                <ns1:PaymentTerm>Due Upon Receipt</ns1:PaymentTerm>
                <ns1:SoldToId>2c92c0f958aa45600158b4aeab0c323b</ns1:SoldToId>
                <ns1:Status>Active</ns1:Status>
                <ns1:thm_account_id__c>1</ns1:thm_account_id__c>
                <ns1:thm_account_type__c>PRO</ns1:thm_account_type__c>
                <ns1:thm_billing_cycle__c>monthly</ns1:thm_billing_cycle__c>
            </ns2:Account>
			<ns2:SubscribeOptions>
				<ns2:GenerateInvoice>true</ns2:GenerateInvoice>
				<ns2:ProcessPayments>true</ns2:ProcessPayments>
			</ns2:SubscribeOptions>
            <ns2:SubscriptionData>
                <ns2:Subscription>
                    <ns1:AutoRenew>true</ns1:AutoRenew>
                    <ns1:ContractAcceptanceDate>2016-11-30</ns1:ContractAcceptanceDate>
                    <ns1:ContractEffectiveDate>2016-11-30</ns1:ContractEffectiveDate>
                    <ns1:InitialTerm>1</ns1:InitialTerm>
                    <ns1:Notes>Iberostar Ciudad Blanca</ns1:Notes>
                    <ns1:RenewalTerm>1</ns1:RenewalTerm>
                    <ns1:ServiceActivationDate>2016-11-30</ns1:ServiceActivationDate>
                    <ns1:Status>Active</ns1:Status>
                    <ns1:TermStartDate>2016-11-30</ns1:TermStartDate>
                    <ns1:thm_item_id__c>6707</ns1:thm_item_id__c>
                </ns2:Subscription>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f95819b2f80158263a4cf73f58</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
                <ns2:RatePlanData>
                    <ns2:RatePlan>
                        <ns1:ProductRatePlanId>2c92c0f957ae0d300157afd357f66008</ns1:ProductRatePlanId>
                    </ns2:RatePlan>
                </ns2:RatePlanData>
            </ns2:SubscriptionData>
        </ns2:subscribes>
    </ns2:subscribe>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

theinrich Valued Scholar

Valued Scholar

Valued Scholar
Posts: 8
Registered: ‎11-30-2016

Re: Troubleshooting - Invoices created separately using SOAP subscribe() call

Works like a charm. Thanks a lot.