wixPay skipUserInfoPage doesn't work

I’m having an issue with wixpay on skipping the first step of the checkout flow.
I tried everything…Even including the userInfo on the .startPayment(which is Deprecated).
The data gets passed correctly(all the info is pre-filled on the first step of the flow)…It just doesn’t skip…
https://lorewhite.wixsite.com/spidermanse/pay-online

1 Like

Have you read the Wix Pay API and it’s functions?
https://www.wix.com/corvid/reference/wix-pay-backend.html
https://www.wix.com/corvid/reference/wix-pay.html
https://support.wix.com/en/article/corvid-tutorial-processing-payments

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

skipUserInfoPage (Optional)
boolean
Whether to skip the user info page. Defaults to false. The page will be skipped only if user info was passed to createPayment() as a part of the PaymentInfo object.

userInfo (Optional)
PaymentUserInfo
Deprecated : An object representing information about the user. It will be used to prefill user info form during payment process.
Deprecation note : Pass user information to createPayment( ) instead.

I have, and applied it, however it does not work.

Yes it does not work. I believe its a bug.

Can someone from wix take a look at this?

bump

I believe this is still not working. Please correct me if I’m wrong.

For anyone else having this problem, if you can skip adding userInfo, and just let the user enter it in the wix popup, then you can get access to what then entered in can use wixPay_onPaymentUpdate(event)

You can find the code in this tutorial:
https://support.wix.com/en/article/corvid-tutorial-processing-payments

See step 7; but BEWARE: The tutorial says to put it in a backend file named “events.jsw”
but I couldn’t get it to work until I named it event.js.

Also note that this will not run in preview mode, you’ll need to publish the site to get this result

Finally, I did not pass any userInfo from the client side to the backend code that created the payment. But, as you can see, by the time it got to wixPay_onPaymentUpdate(event) it was filled in.

JSON.stringify(event) will look like this:

let event = {
  "payment": {
    "id": "194c8701-ae19-4a59-a7c5-6becbffc6136",
    "amount": 1,
    "currency": "USD",
    "items": [{"name": "Test Product", "quantity": 1, "price": 1}],
    "userInfo": {
      "firstName": "REED",
      "lastName": "BERTOLETTE",
      "phone": "1231231234",
      "email": "reed@somewhere.com",
      "countryCode": "USA"
    }
  },
  "status": "Successful",
  "transactionId": "d9f94030-14e9-493b-b8a2-39bbb6651a20",
  "userInfo": {
    "firstName": "REED",
    "lastName": "BERTOLETTE",
    "phone": "1231231234",
    "email": "reed@somewhere.com",
    "countryCode": "USA"
  }
};

Hope this saves someone time.

I got this problem too… passed in user info object to createPayment(), and set skipUserInfoPage to true in startPayment(), the user info page is still showing up :frowning:
Anyone able to get it to work?

@reedbertolette

Yes the tutorial is wrong, it should be placed in the events.js file in the Backend.
Thanks for pointing it out and unfortunately it should have been amended last year.

Also, yes with Wix Pay API and Wix Pay Backend API you do need to publish the site first for it to fully work, as stated in the API for it.
To work with the Pay API, you need to save and publish your site.

The Wix Pay Backend API does however show it correctly for the onPaymentUpdate function itself and for paymentUpdateEvent as well.
https://www.wix.com/corvid/reference/wix-pay-backend.Events.html#onPaymentUpdate

Examples
An event fired when a payment transaction status is changed

// Place this code in the events.js file
// of your site's Backend section.

export function wixPay_onPaymentUpdate(event) {
// rest of code //

@Brett Haralson (Wix)
This error needs changing as soon as possible on the tutorial as it should not be placed in a jsw module as it should be in the events.js in the backend.

Please check the Wix Pay API and the code example that is given to you there.
https://www.wix.com/corvid/reference/wix-pay-backend.html#createPayment

Create a new payment with user information

/**************************
 * backend code - pay.jsw *
 **************************/

import wixPay from 'wix-pay-backend';

export function createMyPayment(userInfo) {
  return wixPay.createPayment({
    items: [{
      name: "Product Name",
      price: 9.99,
      quantity: 2
    }],
    amount: 19.98,
    userInfo
  } );
}

/********************
 * client-side code *
 ********************/

import {createMyPayment} from 'backend/pay';
import wixPay from 'wix-pay';

export function myButton_click(event, $w) {
  const firstName = // the user's first name
  const lastName = // the user's last name
  const phone = // the user's phone number
  const email = // the user's email address
  const countryCode = // the user's country code

  createMyPayment( { firstName, lastName, phone, email, countryCode } )
    .then( (payment) => {
      wixPay.startPayment(payment.id);
    } );
}

Plus note that it is set to default of false, which means that it will still be shown and the page will be skipped (set as true) only if the user info was passed to createPayment…

https://www.wix.com/corvid/reference/wix-pay.html#PaymentOptions
Whether to skip the user info page. Defaults to false. The page will be skipped only if user info was passed to createPayment() as a part of the PaymentInfo object.

@GOS please note from my above comment that I am doing exactly what is suggested in the reference, that I passed in an userInfo object to createPayment(), as well as passing in the skip option as true. It is simply not skipping the user info page despite the requirements are met.

Also, just to check with your code on the page, if you have items in the frontend, then you need to be using $item with async, as Yisrael mentions in this previous post.
https://www.wix.com/corvid/forum/community-discussion/wix-pay-api-help

Okay Doraemon, can you post your editor url for your site and we can get a Wix Mod to look at it properly for you and check your fully used code.

It is only Wix Admin and Wix Mods who have the permissions to view your editor, nobody else will be able to view it including us Masters and Ninjas.

https://editor.wix.com/html/editor/web/renderer/edit/c40e80f1-b588-4cbf-a1be-65b69bd8dfbd?metaSiteId=a5e0ae9a-a34e-499d-8d4f-436f5942375f&editorSessionId=6be0cd80-d8d0-4d0b-a221-96ba316be3ce&referralInfo=my-account
I have a page “/test-code” with a button, so that the button click handler function will call backend code to createPayment() with user info, and then call startPayment() with skipUserInfoPage set to true. When you click on the button, the user info page still shows up, with the user info which was passed to createPayment() already filled in the form.

@nancyhyyip
Thanks, I’ve put a request in for somebody to have a look at it for you, so fingers crossed they can have a look and see what the issue is with yours. :crossed_fingers:

Please post a reply if you get it solved so that other forum users can know what the issue was, thanks.

@givemeawhisky will do. thank you!

any update?

Any news on that issue ?