"paymentType":"wixPay_Offline"

I have several services that I allow the user to either pay online or pay offline (in-person). When I use Wix’s “built-in” Booking pages to book the services the user is offered Credit Card, Paypal and In-Person as expected, (see fig1).


fig1

However when I used the
wixBookings.checkoutBooking(bookingInfo,options) function for that same service and send the paymentType = wixPay_Offline the user is still prompted to pay for the class, see fig2


fig 2

On my service here is the payment settings:

And finally my payment options:

When executing the checkoutBooking() here is that code:


 
let options = {}
if (processCoupon && GrouponValid) {
        options = {
         "paymentType":"wixPay_Offline"
        }
}
if (cleanForm) {
 //$w('#iSubmit').enabled = false;
        $w('#iStatus').text = 'Please wait...';
        $w('#iStatus').text = options.paymentType; //verify pay type
        console.info('Submitting Registration')
        // booking checkout  
        wixBookings.checkoutBooking(bookingInfo,options)
            .then( (results) => {
                $w('#iStatus').text = 'Please wait...Loading Payment.';
                $w('#iStatus').text = results.status;
                console.info(results.status);
 
            } )
            .catch( (error) => {
                console.info(error)
                $w('#iStatus').text = error.message;
 //$w('#iSubmit').enabled = true;
                } );
    }
 else {
 return false;
    }

What am I missing? Why is the user still being prompted to pay online?

You call the checkoutBooking() function. You pass the selected slot object, the values for the form fields, and the payment type if necessary. Note, the specified payment type must match the service’s configuration in your site’s Dashboard . You cannot book a paid service as if it were free.

When calling checkoutBooking(), you can optionally pass an object that defines the payment options. If you are using services which are paid for offline, you will not be passing any payment options.

  • If the service is free, you do not need to pass a paymentOptions object.

  • If the service is not free and you pass a paymentOptions object indicating the payment should be online, a payment popup is presented for the user to enter payment information, such as credit card information.

  • If the service is not free and you pass a paymentOptions object indicating the payment should be offline, the payment popup is not presented to the user.

https://www.wix.com/corvid/reference/wix-bookings.html#PaymentOptions

// booking checkout
wixBookings.checkoutBooking(bookingInfo)
.then( (results) => { 

Hi Wisky,

ok, so if I understand correctly… my service is “Paid”, but allows the user to pay online or to pay offline in person at the time of the service, and the user selects to pay off line then I don’t even need to pass the paymentOptions?

However when I just sent the bookingInfo as you showed above I get a “Unexpected token < in JSON at position 0” error.
wixBookings.checkoutBooking(bookingInfo)

I am also confused on if you don’t send the paymentoptions object then what is the purpose of the wixPay_Offline variable?

Thank you for your help.
David

Yep I read it wrong and you are not wanting free so you still need that options in there.

With regards to your manual payments, have you actually gone through and given yourself a title that the user can use for them as shown in the Wix Support pages for it or did you just turn the toggle on?


https://support.wix.com/en/article/setting-up-manual-offline-payments

If that isn’t the issue then simply try what it states in the code examples as currently you have it set up with no options mentioned before you have closed the curly brackets back up, obviously you will need to add an extra closed curly bracket ‘}’ at the end of your code or add it straight underneath the paymentType options section.

let options = {}
// rest of code //
  
let options = {
if (processCoupon && GrouponValid) {
"paymentType": "wixPay_Offline",
// "couponCode": "thecouponcode" - not used in your code //
}

wixBookings.checkoutBooking(bookingInfo, options)
.then( (results) => {
// rest of code //

Remember that Wix Bookings offline payments are classed as in person too.
https://support.wix.com/en/article/accessing-payment-setup-in-wix-bookings-8174473
To receive payments from customers in Wix Bookings, you must select a payment method. Wix offers a number of payment gateways, or you can use the manual (in person) payment method.

Also, have you checked Wix Bookings own support pages as they already offer an option for you.
https://support.wix.com/en/article/setting-up-manual-in-person-payment-in-wix-bookings

Wix Bookings allows you to receive manual (in person) payments from clients. You can set a different payment method for each service.

Hi Whisky,

Let me provide a little more context that may better explain my scenario.

We provide training class in which we expect payment. We allow users to pay online via a CC/Paypal or by selecting “Pay-In Person” with cash or voucher that they must bring on the day of the class. This is why our services are set to “Online & In Person”… and this works great if I use Wix’s built-in pages that come with the Booking App. We’ve been using this for about 2 years with no issues.

However we wanted a better user experience by building our own Booking Process. We’re able to show more details about our services, ask the user questions, etc. In our new process if the user enters in a Voucher/Groupon code in the Coupon field our system will identify it by a pattern and set the variable “GrouponValid” to true. If Identified as a Voucher/Groupon system should send “wixPay_Offline” as the payment type, because the voucher is the same as cash and the student will bring that on the day of the class.

So with the two payment options all are “Services” must be set to “Online & in Person” to allow for both scenarios.

I spent most of the day trying different options to send the variables to wixBookings.checkoutBooking() function. With or without the coupon, not sending the payment array, etc…

Everything works great if I sent “wixPay_Online”… but when I enter “wixPay_Offline” nothing changes, it still requests Online Payment.

Like I said above, if I fall back to the Wix built in pages for this service, the ones built by Wix, everything works as expect and I can select “Pay in Person” and it will not ask for online payment… so I know the service is setup properly.

You can see the service here using Wix’s built-in pages:
https://www.warriorscalltactical.com/bookings-checkout/combat-pistol-level-1-nov-10-2019-2

In the meantime while waiting for a response I am going to create another service and see if this is a bug with this particular service. I am suspecting that because your support confirmed an issue with the Booking Service which effected this particular Service a couple of weeks ago. Even after their bug/fix this service is still flaky…

UPDATE - No, I created a new service and the same thing happens.

If I don’t find a solution I would like to know next steps, as I am paying for this functionality and I really do think this is a bug.

Thank you
David

Circling back on this item.

Steps for support on how to execute this code:

  1. Go to my Booking page: https://www.warriorscalltactical.com/book-online (takes a moment to load)
  2. Find any available Service and click the “hidden” link (Area in Yellow) to execute the code in question:

  1. Once clicked this will open the LightBox that has the code with the issues.
  2. If not logged in please use a test account.
  3. Fill out the form; First Name, Last Name, Phone, Email.
  4. In the Discount Coupon Field enter in “grpn1234”
    • the system will see this as a Groupon Code and set the payment type to “wixPay_Offline”

  1. Click the “Next” button to execute the function to check the form, set the “bookingInfo” and “options” for the wixBookings.checkoutBooking(bookingInfo,options) function.

Note: Upon clicking the Next button the system will populate a text field with the value of options.paymentType so that you can see the payment type being submitted, highlighted.

Note: even though the system was instructed to submit an offline payment for this booking, the payment popup is presented:

No prompt for payment should have been presented to the user.

Hi, David.

The fix was released to allow offline payment in case you require it and the service is allowed to be payed offline.

You can test the flow on your site.

David, does this fix work for you? On my Site the booking API provides an “500 Internal Server Error” on paymentType = “OFFLINE” or “ONLINE_AND_OFFLINE”, if the course is defined for offline payment.