Happy Business Starts Here

Zuora Support

[REST] Preview subscription is not returning InvoiceItems regardless of success

Problem:

 

When making an api call to preview a PUT subscription call, the response returns only a success along with mrr and tcv. We are expecting an array of invoice items but

 

Request:
"termType" : "TERMED", 
"termStartDate": "2020-01-10", 

"invoiceTargetDate": "2020-01-10", 
"renewalTerm" : 12, 

"notes" : "test", 
"documentDate" : "2020-01-31", 
"autoRenew" : true, 
"update" : [ { 
"serviceActivationDate" : "2020-01-31", 
"ratePlanId" : "2c32c0fb6f69490d0262de7b83c1840", 
"contractEffectiveDate" : "2020-01-31", 
"chargeUpdateDetails" : [ { 
"ratePlanChargeId" : "2c92c05b6f69f906016f67e9b82d183a", 
"quantity" : 200.00, 
"price" : 517.44 
} ] 
}, { 
"serviceActivationDate" : "2020-01-31", 
"ratePlanId" : "2c92c04b6269f90d0136f6d29b82c1848", 
"contractEffectiveDate" : "2020-01-31", 
"chargeUpdateDetails" : [ { 
"ratePlanChargeId" : "2c92c03b6f69f92d016f63e9b82d1349", 
"quantity" : 100.00 
} ] 
} ], 
"remove" : [ ], 
"preview" : true, 
"includeExistingDraftDocItems" : false, 
"currentTermPeriodType" : "Month", 
"currentTerm" : "12", 
"add" : [ ] 
}

 

Response:


"success" : true, 
"totalDeltaMrr" : 16504.400000000, 
"totalDeltaTcv" : 199356.696773542 
}

 

Solution:

 

This is because there is a field called "invoiceTargetDate". This field plays a huge role and that is why you are not receiving the "InvoiceItems". As you can see in the payload I have, the contractEffectiveDate and serviceActivationDate of the rate plan charges are dates that are AFTER the invoiceTargetDate. This is important because what the invoiceTargetDate does is pick up all the charges that is ON or BEFORE the invoice target date. In my example, I changed my contractEffectiveDate and serviceActivationDate to a date before the target date ( 2020-01-03 ) now the the charges are able to show up since it is before the invoiceTargetDate.

 

Now, I am getting the Response of

 

Resp 

"success" : true, 
"totalDeltaMrr" : 16504.400000000, 
"totalDeltaTcv" : 235252.696773542, 
"invoice" : { 
"amount" : 83791.57, 
"amountWithoutTax" : 83791.57, 
"taxAmount" : 0.00, 
"invoiceItems" : [ { 
"serviceStartDate" : "2020-01-31", 
"serviceEndDate" : "2020-07-02", 
"chargeAmount" : -761.54, 
"taxAmount" : 0E-9, 
"chargeDescription" : "Stakeholder User Fee", 
"chargeName" : "Stakeholder User Fee", 
"productName" : "Standard", 
"productRatePlanChargeId" : "2c92c0f846bf505a2016c305b67f8f42f2", 
"quantity" : 50.000000000, 
"unitOfMeasure" : "Stakeholder User" 
}




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