Handle User Status Trouble #191
Unanswered
connallykendrick
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've set this up using the logic provided in the documentation -
_"Example code that handles all subscription states
Below is example code that handles all the states a user's subscription can enter.
const extpay = ExtPay('my-extension-id');
extpay.getUser().then(user => {
})"_
I've had to modify by swapping the order of else if (user.subscriptionStatus === 'canceled') BEFORE else if (user.subscriptionCancelAt && user.subscriptionCancelAt < new Date()) in order to get it to work correctly when I change the status to Canceled.
The problem now comes to the cancellation period - After a user cancels, but their features have not yet run out - triggering for that event.
Is this because of what the documentation says - "user.subscriptionStatus remains active (and user.paid is true) through the end of the billing cycle." ?
If that's the case.. it makes sense why this wouldn't be working -
"_ if (user.paid) {
}_"
is right there at the top, so if that's returning True, everything else is irrelevant thereafter.
@Glench - Does this seem to make sense as to why I can't get a cancellation period to trigger an event? Based off of the documentation?
It's late, so I don't have my set up to test this out, but I wanted to bring it to the attention of yourself and others the issue I'm having with it - however, if I'm doing something totally wrong here, please let me know. It's the only part of provided logic I'm having trouble with.
Beta Was this translation helpful? Give feedback.
All reactions