How can I handle only Read APIs

Hello! Recently I’m trying to create a system that allows to let users to create their own product and make the payment via price quotes and of course invoices. In this case, I just created a page and everything looks okay about the coding side (at least I think because there is no problem for now).

Example :

  1. The user visited the page

  2. User has selected own choices about his own product

  3. User selections affected to the “lineItems” parameter of price quote creator function ( here it is )

  4. The user clicked the “pay” button

  5. After clicking pay button code should create a priceQuote with user selections and send it to the user.

When I test it with an Admin account everything works well done but there are no permissions for normal members (the page will be just available for members)

Anyone has any idea to handle this how can I bypass the permission or is there any way to handle this?

Here is the page : https://www.exweiv.store/yayincilar-icin-ozel-paket

One thing that I see in your code, is that the following lines of code are not in the page’s onReady() function:

let user = wixUsers.currentUser;
let id = user.id;

The wix-users API states:
The APIs in wix-users can only be used once the page has loaded. Therefore, you must use them in code that is contained in or is called from the onReady() event handler or any element event handler.

Not sure if that will solve your problem, but it’s definitely worth fixing and then giving it a try.

I will change it but my question is not about that

@loeix The issue could very well be about that . Admin is different than other users, and it could be that the currentUser isn’t yet available when you try to run for regular users.

@Yisrael (Wix) I already did that so it’s still not working the reason is there is no permission for members to send a price quote to themselves or someone else.