When a user cancels a subscription on my site this block of code will run:
cancelPlan(wixUsers.currentUser.id)
.then( (results) => {
if (results === "SUCCESS") {
wixPaidPlans.cancelOrder(orderId)
.then( () => {
wixWindow.openLightbox("PlanCancelled");
})
.catch( (err) => {
wixWindow.openLightbox("PlanCancelFailed");
});
}else {
wixWindow.openLightbox("PlanCancelFailed");
}
})
.catch( (err) => {
wixWindow.openLightbox("PlanCancelFailed");
});
cancelPlan() is a backend function that removes some extra information from a collection on my site prior to order removal. Since this code runs client-side would it be possible for a user to manipulate the code to only run the wixPaidPlans.cancelOrder() for example? The cancelPlan() function ensures a user will no longer be able to access certain HTTP functions I have exposed on the website so if this was possible this could cause issues.
Is this something I should be worrying about? And if so does anybody have any suggestions on how I could go about sorting this? I was hoping to suggest adding a ‘onPlanCanceled’ event in Corvid but without publishing the website I can’t use the “request a feature” yet.