Handle User Status Trouble #192
-
I've set this up using the logic provided in the documentation - _"Example code that handles all subscription states 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 - @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.
Replies: 2 comments 4 replies
-
I'm not sure why this posted to the Discussion Board twice (feel free to delete the other), but I think I've got a solution for this. I'll test more and report back. |
Beta Was this translation helpful? Give feedback.
-
Okay @Glench, so I've done some testing. I haven't cleaned my code up yet, but felt confident after using logs that this is now working as it should. My extension's logic is a bit more in depth with what goes on, but I applied the piece that made this work for me to the code provided in the documentation. Maybe you'll find it fit to update the code there - Here is the code modified from the documentation to reflect the changes that made this work as it should, for the cancellation period between when a user cancels their subscription and when the end of the features pay period finishes (user status remains "active" (and user.paid is true) during this period of time, until changed to "canceled") `extpay.getUser().then(user => {
})` After further testing, I'll confirm again in the future that I'm having no issues |
Beta Was this translation helpful? Give feedback.
Hey @connallykendrick thanks for pointing this out. I believe it should be this instead :
I've updated this in the documentation.