Using wix-booking API on a dashboard page

Hi,
one of my clients has a special need so he doesn’t want to give users the possibility to book appointments with wix-booking on their own, but he enters them directly from the dashboard.

In addition to this he needs that when a reservation is made, the relevant data is transmitted to an external system (to simplify, even a simple google sheet…).

To meet these needs I thought to create a custom page in the dashboard and use the wix-booking API, and to write at the same time the data in a custom table in the database, so I can send the data to the eternal systems via hook.

So I created a page that goes through the typical booking lifecycle described in the documentation, and it all works in the sense that I get to create a new booking with checkoutBooking( ) , but without the payment options.

The problem arises when I try to use the value “package” in the payment options, so I thought to get the options available with getCheckoutOptions( ) first, and only at this point I made the bitter discovery that “returns only the options available for the currently-logged-in user”, but I’m writing the code on a page of the dashboard, so I 'm the currently-logged-in user (yes, I am new on corvid…).

Sincerely it escapes me the sense of not considering the user whose email is inserted in the checkout form, but since it’s so, the question is if there’s some way to get and then pass the options available for the user inserted in the checkout form, and not the currently-logged-in user.

I apologize for the length of the post, but I wanted to indicate the full flow because if someone sees the possibility to improve it also in other points (meeting the two requirements expressed) any suggestion is welcome.

1 Like