Display Session Count and Session remaining in custom built page

Question:
How can i display Session Count and Session Remaining on a custom built. This page show clients how many sessions are left for the month

Product:
[Which editor or feature is your question most relevant to? e.g. Wix Editor, Wix Studio Editor, Editor X.]

What are you trying to achieve:
I have tried using getting Pricing Plan, and Client information and I don’t see a property for it

What have you already tried:
I cannot find any resources for this or API for this data

Additional information:
I would like to display “2/3” remaining session/total session

Sessions sound like they’d be part of Wix Bookings. If that’s the case then the wix-bookings-backend API exposes a lot of useful functionality. If some of it is data you need to expose to your end users then you’ll want to wrap them in a Velo Web Module and be careful to only return the data a user needs and only to that given user.

Hi @anthony , thank you for your responses.

In details:

the remainingSession/totalSessions (2/3), will be coming from a Pricing Plan when a client/user has subscribed to a Pricing Plan with a total of 3 sessions per month.

using the wix-bookings-backend requires to add a sessionId which is not tired to a Service but to a Pricing Plan or a Subscription.

Please take a look at the screenshot attached

Thank you

Got this figured out. The API for the remaining amount of cycles is in pricing-plans and is called cycleCount

You can get this data with https://www.wix.com/velo/reference/wix-pricing-plans-frontend/orders/listcurrentmemberorders

I don’t see anything for total cycles but this could perhaps be figured out by the difference between start and end dates.

Anthony’s solution isn’t related to what I’m looking for, and this issue is not solved. Cycles aren’t the same as sessions. See the two screenshots. One is from manage subscription, showing that a subscription in which there are 4 of the original 10 sessions remaining. The second is a screenshot from the Velo debugger in which I console.log() output the order for that same subscription. Nowhere in this data do I see either the 4 or the 10.


I have found the solution for this one. Use the functions in wix-bookings-frontend. I’ve described this in more detail here:

To do it, you need to get the booking service, the schedule ID associated with that service, and an upcoming session related to that service. You can find the APIs for this in wix-bookings.v2 and wix-bookings.backend.

Once you have that, you can use the APIs in the wix-bookings-frontend module to convert the upcoming session to a slot, and then get the checkout options for the user related to that slot. The checkout options include the total credits and remaining credits, which I believe are what you are looking for.