We are creating a custom bookings flow, its all working to fetch services and select a time slot but I’m getting an internal wix JS error when attempting to call wixBookings.checkoutBooking
I have no idea why wix-pay wouldn’t be set up on that object internally. I can use wix-pay by itself to create a payment just fine.
// The slot and formFields are valid, it fails when calling checkoutBooking
const checkoutResults = await wixBookings.checkoutBooking(bookingInfo, { type: 'wixPay_Online' } );
/* This is the error in the Developer Console:
wix-pay.dao.ts:9 Uncaught (in promise) TypeError: Cannot read property 'startPayment' of undefined
at wix-pay.dao.ts:9
at _r (checkout-booking.ts:27)
at Object.<anonymous> (checkout-booking.ts:22)
at tslib.es6.js:100
at Object.next (tslib.es6.js:81)
at a (tslib.es6.js:71)
Here's the code from that file that its failing on:
export function payWithWixPay(snapshotOrderId: string){
return self['wix-pay'].startPayment(snapshotOrderId, { showThankYouPage: false }).catch((err) => reportError(wixPayErrorsMapping[500],err))}
I can see in the Network calls that a POST to /_api/frontend-module/booking succeeded:
And returned the following response:
{
"errors":[],
"booking": {
"wixPayPaymentId" : "ea1b80da-74ec-41fa-b8e5-96f6b3a51257",
"id":"4ed5ac3c-3fa1-41c0-83da-37d2d2b202b4",
"status":"PENDING_WIX_PAY_APPROVAL"
}
}