Hi guys, I’m currently develop a small app for shopify using cli 3.0 remix, now and now i’m stuck at trialDays, how i can get how many days are left?
What i’m trying right now to find a solution, i don’t know if its the best solution for getting the remaining days from trial:
- I do a query after customer approve the app:
query {
currentAppInstallation {
id
activeSubscriptions {
id
trialDays
currentPeriodEnd
createdAt
}
}
}
- And is getting the response:
"activeSubscriptions": [
{
"id": "gid://shopify/AppSubscription/xxxxxx",
"trialDays": 1,
"currentPeriodEnd": "2024-03-06T23:15:42Z",
"createdAt": "2024-02-04T23:15:31Z"
}
]
- Start calculate the difference between createAt and currentPeriodEnd, but its weird because i have only 1 day as a trial and on the code from above its saying 2 days from 04-02-2024 to 06-02-2024.
I did some investigation but i find only this answer which looks what i really need but i can’t used because is with Rest api and not GraphQL. “The trial ends on calculated based on the RecurringApplicationCharge’s activation time.”
It is possible to use rest api inside of remix.js?