Hi, im new in WIX corvid API.
I created a simple page where you can select date package and additional attractions. All this have a price. I created a new button and followed https://support.wix.com/en/article/corvid-tutorial-processing-payments This tutorial. But my button still does not do anything… Here’s my code:
//Front page for client
export function buyButton_click(event) {
// Step 2 - Call backend function.
// (Next, see step 3 in the backend code below.)
createMyPayment()
// When the payment has been created and a paymentId has been returned:
.then( (payment) => {
// Step 5 - Call the startPayment() function with the paymentId.
// Include PaymentOptions to customize the payment experience.
wixPay.startPayment(payment.id, {
“showThankYouPage”: false
})
// Step 6 - Visitor enters the payment information.
// When the payment form is completed:
.then( (result) => {
// Step 7 - Handle the payment result.
// (Next, see step 8 in the backend code below.)
if (result.status === “Successful”) {
wixWindow.openLightbox(“Success Box”);
} else if (result.status === “Pending”) {
wixWindow.openLightbox(“Pending Box”);
}
} );
} );
}
//backend pay.jsw
import wixPay from ‘wix-pay-backend’;
import {session} from ‘wix-storage’;
export function createMyPayment() {
let paymentRequest = {
“items”: [{
name: session.getItem(“FirstTitle”),
price: parseFloat(session.getItem(“FirstPrice”))
},
{
name: session.getItem(“SecondTitle”),
price: parseFloat(session.getItem(“SecondPrice”))
},
{
name: “Attractions”,
price: parseFloat(session.getItem(“Attractions”))
}
],
amount: parseFloat(“total”)
}
return wixPay.createPayment(paymentRequest);
}
//Event.jsw
export function wixPay_onPaymentUpdate(event) {
let paymentId = event.payment.id;
let newTransactionStatus = event.status;
let userInfo = event.userInfo;
}
What did i did wrong? I made a connection with paypal account in dashboard.