Recurring charge balanceUsed is higher than cappedAmount and unable to increase cappedAmount further

Highlighted
Shopify Partner
29 0 3

Some help would be appreciated as I have a customer unable to access account and I believe this is a bug on Shopify's end.

Current error I am unable to get past:

Validation failed: Capped amount cannot be lower than balance used

I am requesting a cappedAmount of 500 via the `appSubscriptionLineItemUpdate` mutation, and here is the current subscription details pulled from GraphQL:

 

{
  "data": {
    "currentAppInstallation": {
      "activeSubscriptions": [
        {
          "name": "Professional",
          "status": "ACTIVE",
          "createdAt": "2020-06-01T11:01:49Z",
          "id": "gid://shopify/AppSubscription/13437141089",
          "test": false,
          "trialDays": 3,
          "currentPeriodEnd": "2020-07-04T11:01:58Z",
          "lineItems": [
            {
              "id": "gid://shopify/AppSubscriptionLineItem/13437141089?v=1&index=0",
              "plan": {
                "pricingDetails": {
                  "__typename": "AppRecurringPricing",
                  "interval": "EVERY_30_DAYS",
                  "price": {
                    "amount": "99.0",
                    "currencyCode": "USD"
                  }
                }
              }
            },
            {
              "id": "gid://shopify/AppSubscriptionLineItem/13437141089?v=1&index=1",
              "plan": {
                "pricingDetails": {
                  "__typename": "AppUsagePricing",
                  "balanceUsed": {
                    "amount": "112.0",
                    "currencyCode": "USD"
                  },
                  "cappedAmount": {
                    "amount": "100.0",
                    "currencyCode": "USD"
                  },
                  "interval": "EVERY_30_DAYS",
                  "terms": "$0.5 per ticket sold"
                }
              }
            }
          ]
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 5,
      "actualQueryCost": 5,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 995,
        "restoreRate": 50
      }
    }
  }
}

 

0 Likes
Shopify Staff
Shopify Staff
587 71 128

Hey @Jeff-Blake,

Can you kindly provide the X-Request-ID value from the response header of your mutation that fails? I'll check the logs and see what information I can find.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Shopify Partner
29 0 3

Hi @_JB 

I actually don't know how to track the request ID using the Ruby shopify_api gem on GraphQL (do you know how?)

 

Does this help?

Timestamp: Jun 28th, 05:25:21 PDT for the appSubscriptionLineItemUpdate mutation.

Request variables:

{
  "id": "gid://shopify/AppSubscriptionLineItem/13437141089?v=1&index=1",
  "cappedAmount": {
    "amount": 500,
    "currencyCode": "USD"
  }
}
0 Likes
Highlighted
Shopify Partner
53 1 11

Hi @Jeff-Blake ,

If using the shopify_api ruby gem you can run the following command before making your request to make the gem print the request ID to the console.

ActiveSupport::Notifications.subscribe('request.active_resource')  do |name, start, finish, id, payload|
  p payload[:result].header.each_header {|key,value| puts "#{key} = #{value}" if key == 'x-request-id'}
end

This may need to be edited a bit depending on how you are using the library.

0 Likes
Highlighted
Shopify Partner
29 0 3

That's using the REST API

0 Likes
Highlighted
Shopify Partner
53 1 11

Sorry about that,

Somehow I missed that you were using Graphql.  It is quite difficult to get the request-id when using the shopify-api ruby gem.  You will likely need to use a custom graphql-client.  May be best to ask as an issue on the Shopify-api ruby library itself.  I'll poke around at this a bit and let you know if I find a way to get the request ID.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 71 128

Hey @Jeff-Blake,

I was able to use the info you provided to find the error in our logs. I've forwarded this to our developers for further investigation, I'll post back here as soon as I have an update to share.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 71 128

Hey @Jeff-Blake,

Did you get this working? I just looked at the charge again and I can see the capped amount has been updated. I don't believe we made any changes, but please let me know if you did anything differently so I can forward that info to our developers as it should help with the investigation.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Shopify Partner
29 0 3

Hey @_JB  thanks for the follow-up. No, I nor the merchant touched anything, but I did notice that it seems to be working again. Have not received a reply/solution to the support ticket. Maybe it self-corrected following a new billing cycle? (A guess, I haven't looked up the billing cycle). Perhaps more likely a developer jumped in there and manually updated the cappedAmount

Likely still a concurrency/lock issue lingering there somewhere.

0 Likes