Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Create Usage charge above the capped amount value

Solved

Create Usage charge above the capped amount value

shivkumar_2512
Shopify Partner
5 0 0

Hi

As per the documentation:

Recurring charged based on usage: Create app usage records to bill merchants based on their usage of the app. The total value of all usage records cannot exceed the cappedAmount.

 

The usage charge API however allows to use an amount that exceeds the cappedAmount.

  1. Can you please help me confirm if this is applicable even if the test flag is false. (In test environment, that is with test flag set to true, api returns 200 OK with negative balance amount. What will be the behaviour in prod environment, that is test flag set to false)
  2. Will the remaining amount that does not exceed the cappedAmount be deducted from the merchant in this scenario? For example, if cappedAmount is 100 and usage charge is called with an amount of 110, will the amount of 100 be deducted or the entire request is not completed?

There is another similar question that was asked in the community but we could not conclude our queries from this: link
 
Thanks
 
Accepted Solution (1)

jon551
Shopify Staff
28 7 5

This is an accepted solution.

Hi Shivkumar_2512,

 

Thanks for your post. When the test flag is not true the system will reject any [REST API UsageCharge creation call] that would cause the cappedAmount to be exceeded.

 

The current behaviour of the UsageCharges creation call going through when the test flag is true and the cappedAmount would be exceeded is considered to be a bug which has now been flagged for repair, and a dev doc update request has been submitted to add some more notes about this to the REST API documentation.

 

The behaviour in production follows the same rule that the [GraphQL equivalent appUsageRecordCreate] is documented as following, which reads:

 

"If you create an app usage charge that causes the total usage charges in a billing interval to exceed the capped amount, then a Total price exceeds balance remaining error is returned."

 

Hope you have a great day,

Jon551 | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 3 (3)

jon551
Shopify Staff
28 7 5

This is an accepted solution.

Hi Shivkumar_2512,

 

Thanks for your post. When the test flag is not true the system will reject any [REST API UsageCharge creation call] that would cause the cappedAmount to be exceeded.

 

The current behaviour of the UsageCharges creation call going through when the test flag is true and the cappedAmount would be exceeded is considered to be a bug which has now been flagged for repair, and a dev doc update request has been submitted to add some more notes about this to the REST API documentation.

 

The behaviour in production follows the same rule that the [GraphQL equivalent appUsageRecordCreate] is documented as following, which reads:

 

"If you create an app usage charge that causes the total usage charges in a billing interval to exceed the capped amount, then a Total price exceeds balance remaining error is returned."

 

Hope you have a great day,

Jon551 | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

shivkumar_2512
Shopify Partner
5 0 0

Hi Jon551

Thanks for the update. We'll handle the response accordingly.

 

Hope you have a great day too!

julien-san
Shopify Partner
3 0 2

Hi Jon551,

Any update about this bug?

It's been about 1 year and a half, and the "Total price exceeds balance remaining" error is still not raised when in test mode.