This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when an offline order is marked as paid.
function wixPricingPlans_onOrderMarkedAsPaid(
event: OrderMarkedAsPaidEvent,
): void;
Information about the offline order that was paid and metadata for the event.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixPricingPlans_onOrderMarkedAsPaid(event) {
const orderId = event.entity._id;
const paidDate = event.metadata.eventTime;
const planId = event.data.planId;
const buyerContactId = event.entity.buyer.contactId;
console.log(
`Order ID ${event.orderId} to purchase plan ID ${planId} was paid on ${paidDate} by the buyer contact ID ${buyerContactId}. The full event object:`,
event,
);
}
/* Full event object:
* {
* "data": {
* "order": {
* "_createdDate": "2024-02-01T10:27:58.453Z",
* "_id": "9af3cbe6-fe27-4fdb-a0b0-892289b03d22",
* "_updatedDate": "2024-02-11T08:13:44.674Z",
* "buyer": {
* "contactId": "402ec90c-235a-45c4-b4cc-52204d5f6b00",
* "memberId": "402ec90c-235a-45c4-b4cc-52204d5f6b00"
* },
* "cancellation": {
* "cause": "OWNER_ACTION",
* "effectiveAt": "IMMEDIATELY"
* },
* "cycles": [
* {
* "endedDate": "2024-02-11T08:13:44.588Z",
* "index": 1,
* "startedDate": "2024-02-01T10:27:58.453Z"
* }
* ],
* "endDate": "2024-02-11T08:13:44.588Z",
* "formData": {
* "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
* "submissionData": {},
* "submissionId": "10206732-e789-40e9-957d-2c7f3398efc6"
* },
* "lastPaymentStatus": "PAID",
* "orderMethod": "UNKNOWN",
* "pausePeriods": [
* {
* "pauseDate": "2024-02-04T10:02:03.726Z",
* "resumeDate": "2024-02-04T13:05:04.465Z",
* "status": "ENDED"
* }
* ],
* "planDescription": "",
* "planId": "0da57ac8-c3d0-4687-8aea-4100781b6386",
* "planName": "Expensive Plan",
* "planPrice": "10000",
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "currency": "USD",
* "discount": "10000.00",
* "fees": [],
* "proration": "0",
* "subtotal": "10000.00",
* "total": "0"
* }
* }
* ],
* "singlePaymentUnlimited": true
* },
* "priceDetails": {
* "coupon": {
* "_id": "07de4c3a-536b-4c30-adb9-991935da1681",
* "amount": "10000.00",
* "code": "sale-day"
* },
* "currency": "USD",
* "discount": "10000.00",
* "planPrice": "10000",
* "singlePaymentUnlimited": true,
* "subtotal": "10000.00",
* "total": "0"
* },
* "startDate": "2024-02-01T10:27:58.453Z",
* "status": "CANCELED",
* "statusNew": "CANCELED",
* "subscriptionId": "0cd18587-a637-4327-a05c-ab4e86bd59fe",
* "type": "ONLINE",
* "wixPayOrderId": "4012ab0c-f1cb-4632-917e-f611de27dcad"
* }
* },
* "metadata": {
* "entityId": "9af3cbe6-fe27-4fdb-a0b0-892289b03d22",
* "eventTime": "2024-02-11T08:13:44.817334927Z",
* "id": "601feaeb-7306-4428-b768-906f12938004",
* "triggeredByAnonymizeRequest": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.