hi,
i'm trying to update specific row in a collection after wix pay event from backend/event.js
insert new row seceded if i use insert instead update but update row not working
can someone help me please?
my code:
import wixData from 'wix-data';
export function wixPay_onPaymentUpdate(event) {
let paymentId = event.payment.id;
let newTransactionStatus = event.status;
let transactionId = event.transactionId;
let firstName = event.userInfo.firstName;
let lastName = event.userInfo.lastName;
let phone = event.userInfo.phone;
let email = event.userInfo.email
let toUpdate = {
"paymentId": paymentId,
// "amount": paymentAmount,
// "currency": paymentCurrency,
"transactionStatus": newTransactionStatus,
"transactionId": transactionId,
// "quantity": quantity,
"name": firstName,
"familyName": lastName,
//"country": country,
"phone": phone,
"email": email,
};
wixData.update("paydb", toUpdate)
Have a look at Nayeli (Code Queen) tutorial as it is very similar to what you are doing, plus all you really need to do is to change the insert to update in your own code.
https://support.totallycodable.com/en/article/setting-up-wix-pay-api-using-wix-code