CurrentPeriodEnd Has Wrong Value

Hi! I’m implementing a subscription using the Billing API with GraphQL. I figured out that the currentEndPeriod started returning the wrong value.

For example, here it’s the API Response:

{
  "currentAppInstallation": {
    "activeSubscriptions": [
      {
        "name": "My Subscription",
        "status": "ACTIVE",
        "id": "gid://shopify/AppSubscription/27034747051",
        "currentPeriodEnd": "2023-10-06T15:48:25Z",
        "test": true,
        "trialDays": 0,
        "createdAt": "2023-10-06T15:45:02Z",
        "lineItems": [
          {
            "id": "gid://shopify/AppSubscriptionLineItem/27034747051?v=1&index=0",
            "plan": {
              "pricingDetails": {
                "__typename": "AppRecurringPricing",
                "interval": "EVERY_30_DAYS",
                "price": {
                  "amount": "49.0",
                  "currencyCode": "EUR"
                }
              }
            }
          },
          {
            "id": "gid://shopify/AppSubscriptionLineItem/27034747051?v=1&index=1",
            "plan": {
              "pricingDetails": {
                "__typename": "AppUsagePricing",
                "terms": "You'll be charged by €0.09 per each extra call",
                "cappedAmount": {
                  "amount": "200.0",
                  "currencyCode": "EUR"
                },
                "balanceUsed": {
                  "amount": "0.3",
                  "currencyCode": "EUR"
                }
              }
            }
          }
        ]
      }
    ]
  }
}

Check that the currentPeriodEnd is only 3 minutes after the createdAt.

Also it’s displayed wrong in the Shopify UI, where it display the due date as today

Current API version is 2023-07. (I tried with 2023-10 as well)

This post has been created on 2023-10-06, so it doesn’t make sense that currentPeriodEnd is the same day.

Hi CharlyTalavera,

This does indeed seem like unusual behavior. The currentPeriodEnd should be based on the interval specified in your subscription plan. If it’s set to EVERY_30_DAYS, then this date should be 30 days after the createdAt date.

There could be several possible explanations for this issue. Here are a few troubleshooting steps:

  1. Check the subscription settings in your app: Ensure that the interval for the subscription plan is correctly set to EVERY_30_DAYS. Also, ensure that there are no specific settings or conditions in your app that might be influencing the currentPeriodEnd.

  2. Check if the issue persists across multiple subscriptions: Try creating another subscription and see if the same problem occurs. If it’s a one-off issue, it might have been a temporary glitch.

  3. Check for any API errors: Carefully review your API response for any errors or warnings that might indicate what’s going wrong.

Try the above troubleshooting steps and let us know if you’re still running into issues - hope this helps!

Hi @Liam , thanks for your feedback.

  1. Check the subscription settings in your app: As you can see the interval in the API Response is correctly setup to “interval”: “EVERY_30_DAYS” I also checked for any specific setting that could cause this issue but I didn’t find anything.
  2. Check if the issue persists across multiple subscriptions: Yes it does. It passed 5 days now and it still happening on every subscription that I create on many development stores.
  3. Check for any API errors: There is not any error. Here I have the subscription create response and as you can see all looks good:
{
  "appSubscriptionCreate": {
    "userErrors": [],
    "appSubscription": {
      "id": "gid://shopify/AppSubscription/27034747051"
    },
    "confirmationUrl": "https://somestore.myshopify.com/admin/charges/48978657281/27034747051/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRsKwirgGVLBgA6EmF1dG9fYWN0aXZhdGVU--1c2f376f7e6ffff85a640c112562ae7e01b6e599"
  }
}

Please let me know what do you think. I just tried it and it still happening, this is really annoying.

Thanks for you time!

I am facing the same issue. Did you find a solution for this?

Sorry, I didn’t find any solution yet. Somewhere else I read that it was an issue that happens when the test field is true, so hopefully this is not happening on production, it’s just a testing behavior. So I just workaround it for the meantime.

Hey @Liam ! Any suggestion about how to proceed with this issue? Who/where should I contact to reach the right person to let them know about this failure?

Hi everyone!

I contacted support directly via email, and they confirmed us that this is a bug and they will be working on it to fix it.

Sadly, there is not ETA for this fix. So I will update this post as soon as I get feedback to let you know.

Update: I contacted Shopify yesterday. They didn’t fix it yet and ticket still open.

They suggested me to ask for updates again in 2 weeks.

Hi @CharlyTalavera ,
We fixed an issue with the currentPeriodEnd value on test charges. Can you please try creating new charges and let us us know if you’re still running into problems? Thank you for your patience on this!

Hi Al-Ismail. I checked it and looks like the API is now returning the right value:

{
          "currentPeriodEnd": "2024-01-19T02:10:19Z",
          "test": true,
          "trialDays": 0,
          "createdAt": "2023-12-20T02:08:50Z",
}

Thanks for your support!