Happy Business Starts Here

Allow Replay of Usage Creation (Transaction)

Allow Replay of Usage Creation (Transaction)


We would like is a way to tolerate failure and the subsequent replay of the usage data when it is being created.


I would be for you to allow the passing of a unique id within each usage objects (SOAP API). If you have already processed the provided id you can ignore the most recent usage object and report that in the response object.


With this approach we can replay the submission of the same usage object when we are unsure of its success. We can do this without worrying about it being duplicated. This adheres to a stateless RESTful design as each request from any client contains all the information required to service the request and the client holds the session state.


Our Use Case:

Currently we process and group large amounts of usage data that can come in at different points in a month. We require a guarantee that each usage
object we create in Zuora is unique (Don't want to double bill). That it has only been uploaded once and only once even if upload the same usage object multiple times.




On Jan 3rd I may submit a usage object:

QTY: 5

UOM: Local

Start Date: Jan 2nd

Submit Date: Jan 3rd


On Jan 30th I may submit a usage object:

QTY: 10

UOM: Local

Start Date: Jan 2nd

Submit Date: Jan 30th


I need to guarantee that the Usage bucket 'Local' gets two usage objects regardless of how many times I upload these two usage objects. I need that
guaranteed even if I have to submit these two usage objects multiple times. One reason I may have to submit these usage objects many times is the
failure to get the resulting response object in a reasonable amount of time. Additionally the sudden shutdown of the code which submits the data
would also leave me in a state in which I would need to resubmit the same usage data in order to ensure it has been received.


Current Workaround

Currenlty I use the Description field to hold a unique id. Before I uplaod a batch of record I query the Usage Object for descriptions that match the unique ids which I am about to upload. If I find them then I know the usage has already been processed and I can ignore it. This workaround does the trick but it has its limitations.

1) If I upload in parallel I can still have duplicates as one thread could have uploaded since I last checked (No transacitonal guarantee)

2) I am use up my Read/Query quoat against zuora. (You are getting hit with way more requests then is really needed to solve this issue)



Newly Enrolled


Zuora Product Team
Zuora Product Team
Status changed to: Under Consideration
Senior Tutor

I was wondering if there has been any update on this. I would like to suggest you add this request to your Rest API as well. I very much require this feature and would appreciate an update.

Senior Tutor

If this isn't being implemented can I ask what the best practice is to ensure duplicate usage objects don't end up in Zuora? Are there any recomendations/best practices?



We have a unique ID for usage data in our source system and it pushes that to a custom field on the usage object. When pushing new (or possibly duplicate) usage items, we perform a query against the Zuora API to verify that the unique usage ID we are about to push is not present.


It does add one extra query step to verify its not present before pushing the record up.

Senior Tutor

Hi Feisly,


Thanks for responding. This is exactly what I was doing with the SOAP API. Are you able to do this with the new Rest API? 




So we are still using the SOAP API for the usage portion of our integration, but in theory yes the REST API should be capable of this. The original REST usage resource (https://rest.zuora.com/v1/usage) actually might not as it does not appear to handle custom fields (if it does, i dont see it documented).


However, the new "Actions" rest resources certainly will as they are a REST wrapper on top of the old SOAP structures. They also have the distinct advantage over the original REST structures of allowing ZOQL for advanced querying. You will specifically be interested in https://www.zuora.com/developer/api-reference/#operation/Action_POSTquery as it allows you to query any object and its fields. The ZOQL WHERE clause allows up to 200 filter statements so if you were checking by unique ID you could check up to 200 IDs per query to the REST API.



Senior Tutor

Thank you. This was extremely helpful.