I’m working on a ‘shop’ with the wixPay and wixBackendPay functions, but the function that runs after the payment, as shown on the corvid reference, doesn’t work. This is what I have right now. PS: the payment is done via PayPal, not via Wix.
createMyPayment(payProject, user)
.then((payment) => {
wixPay.startPayment(payment.id);
}).then((result) => {
if (result.status === "Successful") {
console.log("successful payment");
paid = true;
let id = payProject._id;
wixData.get("MembersOrders", id)
.then((item) => {
item.payStatus = result.status;
item.payId = result.transactionId;
item.payName = result.userInfo.firstName + " - " + result.userInfo.lastName;
item.payAmount = result.payment.amount
item.paid = paid;
console.log("item.paid " + item.paid);
wixData.update("MembersOrders", item);
});
} else if (result.status === "Failed") {
console.log("failed");
} else if (result.status === "Pending") {
console.log("Pending");
} else if (result.status === "Cancelled") {
console.log("cancelled");
}
});
payProject is defined, but not shown in this code.
The console.log does not show any “successful payment”, “failed”, “Pending” or “cancelled”
The backend is not relevant.
Thanks in advance for your reaction.