An event that triggers when an offline order is marked as paid.
The onOrderMarkedAsPaid()
event handler runs when an offline order is marked as paid.
The received OrderMarkedAsPaidEvent
object contains information about the offline order that was paid.
Note: Backend events don't work when previewing your site.
function 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.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"823f11e2-84fc-402a-b9a3-28a40a3a473d",
* "entityId":"beaf5979-536b-4659-b3fc-78cc08579eab",
* "eventTime":"2022-07-26T15:19:06.150998Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"beaf5979-536b-4659-b3fc-78cc08579eab",
* "planId":"a4d57b6c-42eb-4416-b8dd-196f1c321b78",
* "subscriptionId":"09c34718-6735-435c-8dd4-9ba7d7dcaa3e",
* "wixPayOrderId":"c83359a7-833f-4689-8451-0f1211bdf184",
* "buyer": {
* "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86",
* "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86"
* },
* "priceDetails": {
* "subtotal":"33",
* "discount":"0",
* "total":"33",
* "planPrice":"33",
* "currency":"EUR",
* "singlePaymentForDuration": {
* "count":6,
* "unit":"MONTH"
* }},
* "pricing": {
* "singlePaymentForDuration": {
* "count":6,
* "unit":"MONTH"
* },
* "prices": [{
* "duration": {
* "cycleFrom":1,
* "numberOfCycles":1
* },
* "price": {
* "subtotal":"33",
* "discount":"0",
* "total":"33",
* "currency":"EUR"
* }
* }]},
* "type":"OFFLINE",
* "orderMethod":"UNKNOWN",
* "status":"PENDING",
* "lastPaymentStatus":"PAID",
* "startDate":"2022-08-01T16:23:00.000Z",
* "endDate":"2023-02-01T16:23:00.000Z",
* "pausePeriods":[],
* "earliestEndDate":"2023-02-01T16:23:00.000Z",
* "planName":"One and Done",
* "planDescription":"",
* "planPrice":"33",
* "_createdDate":"2022-07-24T08:17:04.278Z",
* "_updatedDate":"2022-07-26T15:19:06.118Z"
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.