I’m creating a backend function that will run on a dashboard page, which will enter a bunch of bookings for class sessions that have already passed. I already figured out how to getCheckoutOptions to figure out which payment options are available for the session for a particular contact. I assume that I need to use wix-bookings.v2 and call createBooking() and confirmBooking(). But apparently there needs to be some ecommerce stuff in the middle. I have an existing session/slot, and a list of existing contacts.
The three cases I need to cover are:
- Offline payment, which if I interpret thing right I don’t need to use ecommerce.
- Pay using a specific pricing plan. I got the order ID of the pricing plan from getCheckoutOptions, so I would just need to figure out how to specify that it should be used for this booking.
- Mark as confirmed but unpaid.
Can anyone guide me to the correct flow for these three cases?
Thanks.
Correct. Refer to this article for general bookings flow: Creating a Custom Bookings Experience
Not sure on this one. Are you referring to a membership plan? You don’t set prices when Booking so I think Wix’s system handles this automatically. You can also preview/calculate the prices of bookings: previewPrice - Velo API Reference - Wix.com
There are a variety of statuses that can be set: createBooking - Velo API Reference - Wix.com
One problem I’m having is that I am trying to create bookings after the session is completed. I don’t know how to make the session available for booking/checkout after its start time. There seems to be a flag somewhere to enable booking after session start, and there is a latest date time that the session can be booked, but I don’t see anywhere to set any of that information.
I tried to use createBooking and createCheckout, but the returned checkout object included:
"availability": {
"status": "NOT_AVAILABLE",
"quantityAvailable": 0
},
Which doesn’t seem to be defined in the API document, but I suspect is related to the session start time being in the past.
One clue is that I tried to do it manually from the Dashboard using Manage Participants. If I add a participant with a membership-type pricing plan it allows me to add them, but if they have a package-type plan it doesn’t give that option. I’m sure it used to work for both, because I did this process manually that I’m trying to automate for the same class we offered last year.
Also, I want to tell the system which pricing plan subscription to use. I think I can specify “membership”, “package”, or “wixPay_Offline”. But if someone has multiple pricing plan subscriptions and they are the same type (e.g., two different package-type subscriptions) there doesn’t seem to be a way to specify a particular one (presumably by the orderId of the subscription).
createCheckout also has something called membershipOptions, but I don’t have a clue what that is. Is that the same as pricing plan?
All I’m trying to do is create a back office (dashboard) function that will load attendance data for a class when we are unable to create bookings in advance or onsite, because it is a drop-in class and there is no Internet available onsite.
Thanks, Anthony, that’s helpful. I added a new policy for this service. However, it still doesn’t work. I’ve tried creating bookings three different ways, and none of them work. I’m testing on a future session, so there should be no problem with availability.
-
Using the frontend bookings API. When I call wixBookingsFrontend.checkoutBooking() I get an error saying that the Name field is missing. I followed all the docs, got the id for the name field in the services booking form from the Wix documents, and triple checked the id, the spelling on all my fields, the balancing of the brackets, and anything else I could think of, but still get the error.
-
Using v2Bookings.createBooking () and checkout.createCheckout(). The booking is returned with something called v2Availability : false. The checkout returns with a quantity of zero, and “availability”: {
“status”: “NOT_AVAILABLE”,
“quantityAvailable”: 0
},
-
Using v2Bookings.createBooking () and v2Bookings.confirmBooking(). This one actually created a booking (also with v2Availability:false) and confirmed it, but did not create an order to indicate payment. I also tried to set the selectedPaymentOption to “MEMBERSHIP” when I create the booking, no difference.
I also tried confirmOrDeclineBooking() instead of confirmBooking. Same result.
Any help in figuring out how to create a booking and indicate the payment method would be greatly appreciated!
Updated, I’ve now changed to do all three: createBooking, confirmOrDeclineBooking, and checkout. The result is that a booking is created, but it is not linked to any payment. That is true whether I create the booking with payment option to “MEMBERSHIP” or “PAID”.