How to know current recurring charge period?

Highlighted
Shopify Partner
9 0 1

Hello, I have an app implemented recurring charge with $0 each period through shopify appSubscriptionCreate GraphQL admin API and I actually charge customer by usage for that period. also added 11 free trial days for first subscription. 

 

Based on my billing model, I want to charge customer for usage on each period, but I can't find any GraphQL api or webhooks to know exact period start and period end  for current period, which means I don't know when shopify charges customer and the current period.

 

I tried to subscribe to app_subscriptions/update webhook, but there are no period start and end.

 

 

{
  "app_subscription": {
    "admin_graphql_api_id": "gid://shopify/AppSubscription/4324234123", 
    "admin_graphql_api_shop_id": "gid://shopify/Shop/12344664530", 
    "created_at": "2020-01-06T15:32:22+08:00", 
    "name": "Unlimited Usage", 
    "status": "ACTIVE", 
    "updated_at": "2020-01-06T15:32:36+08:00"
  }
}

 

 

I also tried to use GraphQL query activeSubscriptions, there is currentPeriodEn, but the currentPeriodEnd is the date when free trial day ends(createdAt + trialDays). And currentPeriodEnd doesn't update after currentPeriodEnd ends. For this example, it doesn't change when I query it today which is after 2020-01-17T07:32:36Z.

 

 

{
    "data": {
        "appInstallation": {
            "activeSubscriptions": [
                {
                    "name": "Unlimited Usage",
                    "id": "gid://shopify/AppSubscription/12217531331",
                    "status": "ACTIVE",
                    "createdAt": "2020-01-06T07:32:22Z",
                    "currentPeriodEnd": "2020-01-17T07:32:36Z",
                    "test": true,
                    "trialDays": 11,
                    "lineItems": [
                        {
                            "id": "gid://shopify/AppSubscriptionLineItem/12112345621?v=1&index=0",
                            "plan": {
                                "pricingDetails": {
                                    "__typename": "AppUsagePricing"
                                }
                            }
                        }
                    ]
                }
            ]
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 5,
            "actualQueryCost": 5,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 995,
                "restoreRate": 50.0
            }
        }
    }
}

 

My question is:

How do I know current recurring charge period?

 

I appreciate it for any help and suggestions, thanks!

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 166

Hey @Cloudyman,

 

I believe test charges act slightly differently - more info here: https://community.shopify.com/c/Shopify-APIs-SDKs/GraphQL-appSubscriptionCreate-mutation-with-quot-t...

2 Likes
Highlighted
Shopify Partner
9 0 1

Hello @SBD_,

 

I have seen the post you linked.

 

Seems like there is no way to get correct current period start and end in test development, thanks for your reply. 

0 Likes
Highlighted
New Member
2 0 0

Have you found a solution to recover the expiration date in the development test?

0 Likes