Error of “getCheckoutOptions”

We’ve been using a booking service.

Using the value shown by “getCheckoutOptions”, we analyze the types of ticketing plans or membership plans each of users own.

And we have a problem that since Oct 6th, “getCheckoutOptions” is no longer working properly.

For example, using the service, we used to check the number of tickets left or if we still had a free ticket for first-time visitors but any of the data we need are not shown anymore.

However, “getServiceAvailability” is still available in order to use the API above somehow.

So, we are thinking that it is “getCheckoutOptions” that’s having a problem.

Does anyone know how to solve this problem so that we can verify our user’s tickets?

Hi!

Is there any update on this?

I think I am encountering the same problem: getcheckoutOptions doesn’t appear to return any information on pricing plans, despite my ‘test user’ having both a package-type and a membership-type pricing plan set up.

The return I get from getcheckoutOptions is:

{"checkoutMethods":[{"type":"wixPay_Online"},{"type":"wixPay_Offline"}]}

But according to getCheckoutOptions - Velo API Reference - Wix.com

it should return something like:

[{
    "type": "wixPay_Online"
  },
  {
    "type": "wixPay_Offline"
  },
  {
    "type": "membership",
    "planName": "Frequent Flier",
    "planOrderId": "b1a75-...-a236",
    "planExpiration": "2021-01-08T11:39:29.218Z",
    "benefitId": "93de9c-...-48e6"
  },
  {
    "type": "package",
    "planName": "Repeat Customer",
    "planOrderId": "9551f-...-1b8039",
    "planExpiration": "2020-07-08T11:39:11.340Z",
    "benefitId": "8b11cc-...-67a49e",
    "remainingCredits": 58,
    "totalCredits": 60
  }
}]

because available pricing plans aren’t returned, there’s no way to verify in code how many sessions have been purchased by the user (totalCredits) or how many remain (remainingCredits).

I thought I’d found an alternative way by using getCurrentMemberOrders as this returns details of paid plans BUT unfortunately it doesn’t show sessions/credits information.

I really hope someone can help!!!

Thanks!

I’m experiencing exactly the same problem, and it’s not the first bug either. It’s infuriating how difficult Wix bookings is to work with.

@eduard this is Zvi from Bookings Velo team, thanks for reporting this we are checking this issue

@o11 , @info12559 and @eduard This is Jacob from Bookings Velo team. Just letting you know we are working on a solution for this issue.

Thank you! That’s great news.

@jacobg Thanks so much! Can you also please provide an example of how the result from getcheckoutoptions can be read in code? The example in the Velo reference doesn’t appear to work.
Thanks again, Paul

@info12559
Have you followed the order of the functions as described in Introduction - Velo API Reference - Wix.com?
Here is a complete booking flow example.

export async function bookingsPublicflow_click(event) {
    const service = await getServiceId(serviceNameForPublicFlow); //Read service id from bookings collection Bookings/Services
    let serviceId = service._id;
    let firstSlot;
    console.log(`Getting service availability for service ${serviceNameForPublicFlow} with id:`, serviceId);

    let today = new Date();
    let startRange = new Date();
    let endRange = new Date();
    startRange.setDate(today.getDate() );
    endRange.setDate(today.getDate() + 14);   // 14 days from now

    let options = {
        startDateTime: startRange,
        endDateTime: endRange
    };

    await wixBookings.getServiceAvailability(serviceId, options)
    .then( (availability) => {
        console.log("Service availability:", availability)
        let slots = availability.slots;
        firstSlot = slots[Math.floor(Math.random() * slots.length)]; //Random slot
        console.log("Found slots:", slots);
        console.log("First slot:", firstSlot);
    });

    console.log("Getting checkout options for slot id:", firstSlot._id);
    console.log("Which starts on:", firstSlot.startDateTime);
    console.log("And ends on:", firstSlot.endDateTime);

    let checkoutOptions = {
        "slotId": firstSlot._id
    }

    await wixBookings.getCheckoutOptions(checkoutOptions)
    .then((checkoutOptionsResponse) => {
        console.log("checkoutOptions:", checkoutOptionsResponse.checkoutMethods)
        let checkoutMethods = checkoutOptionsResponse.checkoutMethods;
        checkoutMethods.forEach(checkoutMethod => {
            console.log("Available checkout method:", checkoutMethod.type);
        })
    });

    console.log("Bookings a slot that starts on:", firstSlot.startDateTime);
    console.log("Bookings a slot that ends on:", firstSlot.endDateTime);

    let chosenSlot = firstSlot;
    let formFieldValues = [
    {
        "_id": "00000000-0000-0000-0000-000000000001", // name field ID
        "value": "John Doe"
    }, {
        "_id": "00000000-0000-0000-0000-000000000002", // email field ID
        "value": "john@velo.com"
    }
    ];
    
    let bookingInfo = {
        "slot": chosenSlot,
        "formFields": formFieldValues
    };

    let bookingPaymentOptions = {
        "paymentType": "wixPay_Offline"
    }

    console.log("bookingInfo:", bookingInfo);
    console.log("bookingPaymentOptions:", bookingPaymentOptions);

    await wixBookings.checkoutBooking(bookingInfo, bookingPaymentOptions)
    .then( (results) => {
        console.log("Booking response:", results.status, "for booking id:", results.bookingId)
    } );
}

You should expect “Booking response: Confirmed for booking id: <YOUR_BOOKING_ID>”

@o11 , @info12559 and @eduard
The issue is resolved.
For validation, please consider a class service with with a paid plan, online and offline payments.

await wixBookings.getServiceAvailability(serviceId, options)
    .then( (availability) => {
        let slots = availability.slots;
        firstSlot = slots[Math.floor(Math.random() * slots.length)];    
    });

    let checkoutOptions = {
        "slotId": firstSlot._id,
        "userId": wixUsers.currentUser.id
    }

    await wixBookings.getCheckoutOptions(checkoutOptions)
    .then((checkoutOptionsResponse) => {
        console.log("checkoutOptions:", checkoutOptionsResponse.checkoutMethods)
        // let firstOptionType = checkoutOptions[0].type;
        let checkoutMethods = checkoutOptionsResponse.checkoutMethods;
        checkoutMethods.forEach(checkoutMethod => {
            console.log("Available checkout method:", checkoutMethod.type);
        })
    });

The response would look like this:

{"type": "wixPay_Online"},
{"type": "wixPay_Offline"},
{"type": "package",
 "planName": "Paid Plan",
 "planOrderId": "15a7e304-6a53-4da9-bce7-1577f140069a",
 "benefitId": "97dccea8-c45e-4322-aa4b-fac8e4906fde",
 "remainingCredits": 6,
 "totalCredits": 10
}
Available checkout method: wixPay_Online
Available checkout method: wixPay_Offline
Available checkout method: package

Hi @jacobg ,

Thanks for the follow up! Really appreciate it.
Did the fix already get rolled out? I’m testing it with a class service with online payments and paid plans. My logged in user has an active plan* and still gets no information about the plan. Only Online payment is mentioned as an option:

{ “type” : “wixPay_Online” }

  • non-zero sessions left are verified on the “my subscriptions” page

Please reach out if you need more details.

Eduard

@eduard
Please make sure you pass user id when calling checkout options.
Also, please make sure you are reading the correct service id.

@jacobg
Thanks for the response. I did both of those things. However, since maybe an hour ago I’m now getting the correct plan data returned!

My issue is now resolved: Thank you.

@eduard @jacobg

Can I just check whether the issue has returned?

I’ve been testing out the issue on a test site (a free site plan) and all appeared well. Unfortunately, having now updated my live site with the new code, it still only returns:

{type: 'wixPay_Online'}
{type: 'wixPay_Offline'}

This is despite the current user having a valid paid plan available (see screen cap from my-subscriptions page below)


I’ve subsequently went back to my test site and it’s not working there either.

Again, many thanks for your help on this!

Paul

@jacobg

Hi Jacob,
Unfortunately, the problem is back. But not in a reliable way and I suspect it’s the same as when I was having the issue before: getCheckoutOptions() sometimes does, but recently more often does not return information about available plans. Sometimes picking a different slot for the same service would make it return the plan info, sometimes not. Today I was not able to find a slot for which I would get the plan data returned.

This is an extremely bad user experience for our customers: People who paid hundreds of dollars for a membership are unable to use it and we have to book clients manually. Unfortunately, the native Wix Bookings flow that comes with the app is inadequate since it can’t display a schedule for more than one service at a time.

Please help
Eduard