Backend function calling permission error even if the user is logged in

I am having some problems with the login procedure of my website. I do a standard login and I import a backend function with permissions set to SiteMembers:
import { authentication } from ‘wix-members-frontend’;
import { checkoutFreePlan } from ‘backend/planOrder.web’

let authenticationResult = await authentication.login(email, password)
console.log(authenticationResult)
let isLoggedIn = await authentication.loggedIn();
if (isLoggedIn){
let freePlanCheck = await checkoutFreePlan()
console.log(freePlanCheck)
}

When I call the checkoutFreePlan function I got the following error:
Error: Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.
In the logs of the webiste I got:
NotAuthorizedError: Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information

How is that possible as the isLoggedIn function works, I console logged the user details. Why the backend is not seeing the user as logged in?

If I change the permission to Anyone to my backend function everything seems to work.

Any idea or suggestion?

Thank you so much

Hi, @mauriziomassaro !!

Hello :slightly_smiling_face:, does checkoutFreePlan use any Wix APIs? :thinking: It’s possible that the API itself requires some kind of permission setting.