Automatic license creation with Wix backend

I’m trying to get this integration working with PayPal. The Wix Web API has a function that is supposed to fire when a payment status update fires. When I run with the debugger on in the web browser, I don’t see the javascript enter the event code. NOTE this is my first try at javascript, I have done programming in other languanges for years. Here is the “event code” from the Wix backend

import {post_cryptlex} from ‘router’;
import {genPassword} from “genPassword”;
import {createUser, createLicense, renewLicense} from ‘CryptlexApi’;

export function wixPay_onPaymentUpdate(event) {
this.headers = {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘payments2_api1.wix.com’
};

if (event.status === "Successful") {
    createUser('license', event);
    createLicense('renew-license', event);

    if(event.payment.items.name === "license") {
        const productId = 'PASTE_YOUR_PRODUCT_ID';

        // get post params from request data
        const { first_name, last_name, order_id, country, phone, email } = event.userInfo;

        // create license user
        const userBody = {
            email: email,
            firstName: first_name,
            lastName: last_name,
            password: genPassword(12),
            role: 'user'
        };
        
        const user = createUser(userBody);

        // create license
        const licenseBody = {
            productId: productId,
            userId: user.id,
            metadata: []
        };
        licenseBody.metadata.push({ key: 'order_id', value: event.transactionId, visible: false });
        const license = createLicense(licenseBody);

        console.log("license created successfully!")

        // return license key to payment processor
        return license.key;
    }
    else if (event.payment.items.name === 'renew-license') {
        const productId = 'PASTE_YOUR_PRODUCT_ID';

        // get post params from request body
        const { order_id } = event.data.order_id;

        // renew license expiry
        const license = renewLicense(productId, 'order_id', event.transactionId);

        // return new expiry date
        return { message: `License new expiry date: ${license.expiresAt}` }
    }
    else {
        console.log("Event requested was: ", event.payment.items.name)
    }
}
else {
    console.log("Payment update event result was: ", event.status)
}

}

Hello,

We also offer service for writing the integration script which generates license key and mails the key to your customer, at a nominal cost. In case you are interested please contact us at support@cryptlex.com with the details of your workflow.

What error are you getting in this case?

There’s no error. The “event” doesn’t seem to be called even though the call to PayPal and back goes through and the transaction completes. Wix API documentation is not very specific is something is different when calling PayPay rather than their custom WixPay module

Which e-commerce solution are you using with Wix?