For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hi! I'm implementing a subscription using the Subscription 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 , thanks for reaching out!
I understand you're building a subscription app, but this looks like a problem with the billing API. The folks over in https://community.shopify.com/c/billing-api/bd-p/billing would be the best to assist you.
To learn more visit the Shopify Help Center or the Community Blog.
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:
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
.
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.
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!
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 Shopify.dev or the Shopify Web Design and Development Blog
Hi Liam, thanks for your time.
I answered you in the Billing API Post that I made by Jlalande suggestion: https://community.shopify.com/c/billing-api/currentperiodend-has-wrong-value/m-p/2260377
Maybe we can close this one.