GraphQL Billing API Issue

Highlighted
Shopify Partner
17 0 0

Hi,

 

I am having a tough time pinning this down. In general when I query the GraphQL API for billing info I get the correct currentPeriodEnd which is 30 days after the charge was activated like so: 

{
  "data": {
    "id": "gid://shopify/AppSubscription/12878577741",
    "name": "Pay As You Grow",
    "createdAt": "2020-04-25T18:55:46Z",
    "currentPeriodEnd": "2020-05-25T18:56:17Z",
    "test": false,
    "status": "ACTIVE",
    "trialDays": 0,
  },
  "casted_data": {},
  "errors": []
}

 

but sometimes the currentPeriodEnd is just a few days after the date the charge was activate. For Example here:

{
  "data": {
    "id": "gid://shopify/AppSubscription/15100870787",
    "name": "Pay As You Grow",
    "createdAt": "2020-04-22T21:23:47Z",
    "currentPeriodEnd": "2020-04-29T20:08:52Z",
    "test": false,
    "status": "ACTIVE",
    "trialDays": 0,
  },
  "casted_data": {},
  "errors": []
}

 What am I supposed to be using to determine the billing periods? If a store installed and activated a charge on 2020-04-22T21:23:47Z the billing period should end on 2020-05-22 21:23:25 UTC not 2020-04-29T20:08:52Z

0 Likes
Shopify Staff
Shopify Staff
1041 140 167

Hey @Enea,

 

For 15100870787, the merchant first installed the app on 2020-02-29, and uninstalled/reinstalled the app on 2020-04-02 - so the 29th cycle stuck.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Highlighted
Shopify Partner
17 0 0
Is this because this user is on a usage based plan? When users are on paid
plans and uninstall then install again the billing period resets.
Also, how should I know if a user is inside the trial period or not? The
GraphQL api returns a period end date and trial days but I have no way to
know if the trial has ended. As of right now I am having to make a call to
the legacy REST API in conjunction with the GraphQL api to try and figure
out if a Shop is within their trial. Is there a better way to go about
this?
0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

We're looking into brining the trial_ends_on across to the GraphQL API. For now, you'll need to manually calculate (createdAt + trialDays). 

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Highlighted
Shopify Partner
17 0 0
Is the created at date always the same as the date the charge was
activated? Would it be possible to also add the activated/confirmed
timestamp to GraphQL?
0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

Is the created at date always the same as the date the charge was activated?

Good point, these will be different. In that case, for now you'll need to rely on the REST API, or track the activation date on your side.

 

Would it be possible to also add the activated/confirmed timestamp to GraphQL?

I'll pass this feedback along.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Highlighted
Shopify Partner
17 0 0

Thank you

0 Likes
Highlighted
Shopify Partner
17 0 0

What do you think the time table for adding those fields looks like? 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

The discussion is still taking place. There's no ETA.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes