Usage charges with idempotency

Shopify Partner
1 0 0

Hi All,


I'm building a shopify integration in which we need to bill our customers ( the shopify store). The integration creates a recurring charge and then calls the endpoint Create a Usage Charge  to bill the store.


I cannot see that this endpoint has the option to provide an idempotencyKey and want to avoid the scenario in which a store is charged multiple times.


I have 3 questions:

* Does this endpoint support idempotency, but it's not documented?

* Do we need to use a different endpoint (maybe GraphQL?) in order to do a recurring billing that supports idempotency?

* If none of the above apply, what is the recommended way to create a variable charge to a store?


Thanks a lot!

Reply 1 (1)

Shopify Staff
2731 302 777

Hi August0,


There is an AppUsageRecord object on the GraphQL API which has an `idempotencyKey` field which is a unique key generated by the client to avoid duplicate charges. It sounds like this is what you'll want to be working with. 


Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog