Hello, I’ve created a custom form in EditorX which submits to a collection on submit. I then added a payment requirement for submitting, however the data submits to the database whether the payment is completed or not.
I’m trying to configure it so it first checks that payment was successful before submitting the data, but I’m a bit out if my depth and can’t get it working.
My code so far:
import wixPay from ‘wix-pay’;
import {createPaymentForProduct} from ‘backend/BE_PayAPI’;
export function button1_click( event ) {
let payment = await createPaymentForProduct(itemId);
await wixPay.startPayment((payment.id), { “termsAndConditionsLink”: “https://www.wix.com/”});
await wixData.insert(‘dataset1’, item);
});
}
If anyone can help show me where I might be going wrong, that would be great thanks