Sending an email after filling wixPay API form

I’m trying to fill out the wixPay API userInfo and then send an email to a specific email address.

My code works fine when I take out this part:

        .then((result) => {
            console.log("entered");
            if (result.status === 'Successful') {
                console.log("Its worked");
                sendFormData(firstName, lastName, email, phone);
            }
        })

But rejects payments if I add it in.
Front end:

import wixPay from 'wix-pay';
import { sendEmail } from 'backend/email';
import { createPaymentForProduct } from 'backend/BE_PayAPI.jsw';
import { session } from 'wix-storage';

import wixWindow from 'wix-window';
export function checkout_click(event) {
    let firstName = $w("#firstName");
    let lastName = $w("#lastName");
    let email = $w("#email");
    let phone = $w("#phone");
    const $userDataset = $w("#userDataset");
    $userDataset.onBeforeSave(() => createPaymentForProduct($userDataset.getCurrentItem())
    .then( (payment) => {
             wixPay.startPayment(payment.id, { "termsAndConditionsLink": "https://www.tutorsforlife.com/terms-and-conditions" })
        })
        .then((result) => {
            console.log("entered");
            if (result.status === 'Successful') {
                console.log("Its worked");
                sendFormData(firstName, lastName, email, phone);
            }
        }))
}

export function sendFormData(firstName, lastName, email, phone) {
    const subject = `A booking has been made!`;
    const body =` has booked a lesson with you. Their email address is: `;
    let address = session.getItem("tutorsEmail");
    sendEmail(subject, body, address)
        .then(response => console.log(response));
}

Backend (BE_PayAPI.jsw):

import wixPay from 'wix-pay-backend';

export function createPaymentForProduct(userData) {
    console.log(userData.firstName + "first name");
const userInfo = {
    firstName: userData.firstName,
    lastName: userData.lastName,
    email: userData.email,
    countryCode: 'GBR',
    phone: userData.phone,
}

console.log(userInfo)
    return wixPay.createPayment({
        items: [{ name: 'test', price: 1, quantity: 1 }],
        amount: 1,
        userInfo: userInfo
    });
}

Any ideas on why the .then is breaking it?

Thanks