Question:
How are these variables called in WIX database of I need to fetch these? ordernumber, orderamount, shippingcost, VAT
Product:
Wix Editor, Wix Velo
What are you trying to achieve:
Trying to fetch data and send to affiliate marketing partner
What have you already tried:
orderamount and orderid are not being sent
Additional information:
Use onOrderPaid()
Backend Event
This event is triggered when an order is completed/paid. You can use it to access order details and send them to your affiliate system.
In your backend/events.js
file, you can use:
import { wixStoresBackend } from ‘wix-stores-backend’;
export function wixStores_onOrderPaid(order) {
const orderId = order._id;
const orderAmount = order.totals.total;
const shippingCost = order.totals.shipping;
const vat = order.totals.tax;
// Example: Send to affiliate
const dataToSend = {
orderId,
orderAmount,
shippingCost,
vat
};
// Send via fetch, postMessage, webhook, etc.
console.log("Affiliate Payload: ", dataToSend);
}
Common Mistakes to Avoid
- Don’t use
order.orderId
— it’s usually _id
(underscore).
order.totals
must be present — make sure the order is paid (not just created).
- Use
console.log(order)
inside the event to inspect what you receive live.
i can help fix it just message me on my mail