Search.../

onOrderPaid( )

Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onOrderPaymentStatusUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

Description

An event that fires when an order is marked as paid.

The onOrderPaid() event handler runs when an order is paid either via customer checkout, or when marked as paid on your site's Dashboard.

Note: Backend events don't work when previewing your site.

Syntax

function onOrderPaid(event: Order): void

onOrderPaid Parameters

NAME
TYPE
DESCRIPTION
event
Order

Paid order data.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when an order is paid

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3
4export function wixStores_onOrderPaid(event) {
5 const paidOrderId = event._id;
6}
7
8/* Full event object
9 *
10 * {
11 * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447",
12 * "_updatedDate": "2020-05-27T12:20:37.994Z",
13 * "buyerLanguage": "en",
14 * "cartId": "74621781-b3hf-7845-8c9e-09879063da9",
15 * "channelInfo": {
16 * "type": "WEB"
17 * },
18 * "enteredBy": {
19 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",
20 * "identityType": "MEMBER"
21 * },
22 * "billingInfo": {
23 * "address": {
24 * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555",
25 * "city": "New York",
26 * "country": "USA",
27 * "addressLine": "235 W 23rd St",
28 * "postalCode": "10011",
29 * "subdivision": "NY"
30 * },
31 * "firstName": "Jane",
32 * "lastName": "Doe",
33 * "email": "janedoe@gmail.com",
34 * "phone": "+15555555555",
35 * "company": "My company name",
36 * "paidDate": "2020-05-27T12:20:37.994Z",
37 * "paymentMethod": "VISA",
38 * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb",
39 * "paymentGatewayTransactionId": "29A06193U6234935D",
40 * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb"
41 * },
42 * "buyerInfo": {
43 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",
44 * "identityType": "MEMBER",
45 * "firstName": "Jane",
46 * "lastName": "Doe",
47 * "phone": "+15555555555",
48 * "email": "janedoe@gmail.com"
49 * },
50 * "_dateCreated": "2020-05-27T12:20:37.966Z",
51 * "currency": "ILS",
52 * "fulfillmentStatus": "NOT_FULFILLED",
53 * "archived": false,
54 * "activities": [
55 * {
56 * "type": "ORDER_PLACED",
57 * "timestamp": "2020-05-27T12:20:37.966Z"
58 * },
59 * {
60 * "type": "ORDER_PAID",
61 * "timestamp": "2020-05-27T12:20:37.994Z"
62 * }
63 * ],
64 * "number": 10019,
65 * "paymentStatus": "PAID",
66 * "shippingInfo": {
67 * "deliveryOption": "Free Shipping",
68 * "estimatedDeliveryTime": "4:30pm",
69 * "shippingRegion": "Domestic",
70 * "shipmentDetails": {
71 * "address": {
72 * "formatted": "company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555",
73 * "city": "New York",
74 * "country": "USA",
75 * "addressLine": "235 W 23rd St",
76 * "postalCode": "10011",
77 * "subdivision": "NY"
78 * },
79 * "firstName": "Jane",
80 * "lastName": "Doe",
81 * "email": "janedoe@gmail.com",
82 * "phone": "5555555555",
83 * "company": "company name",
84 * "tax": 0,
85 * "discount": 0,
86 * "priceData": null
87 * },
88 * "pickupDetails": null
89 * },
90 * "lineItems": [
91 * {
92 * "index": 1,
93 * "quantity": 1,
94 * "price": 5,
95 * "name": "my product's name",
96 * "translatedName": "Nombre traducido",
97 * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea",
98 * "totalPrice": 5,
99 * "lineItemType": "PHYSICAL",
100 * "options": [
101 * {
102 * "option": "Size",
103 * "selection": "Medium"
104 * }
105 * ],
106 * "customTextFields": [
107 * {
108 * "title": "Notes for delivery",
109 * "value": "Please leave at front door"
110 * }
111 * ],
112 * "weight": 1.42,
113 * "sku": "36523641234523",
114 * "discount": 0,
115 * "tax": 5,
116 * "taxIncludedInPrice": true,
117 * "priceData": {
118 * "price": "5",
119 * "totalPrice": 5,
120 * "taxIncludedInPrice": true
121 * },
122 * "mediaItem": {
123 * "altText": "This is a description of the image",
124 * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg",
125 * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899",
126 * "type": "IMAGE"
127 * }
128 * }
129 * ],
130 * "totals": {
131 * "discount": 0,
132 * "quantity": 1,
133 * "shipping": 0,
134 * "subtotal": 5,
135 * "tax": 0,
136 * "total": 5,
137 * "weight": 1.42
138 * },
139 * "weightUnit": "KG",
140 * "customField": {
141 * "value": "Please call when outside",
142 * "title": "Notes for delivery",
143 * "translatedTitle": "Notas de entrega"
144 * },
145 * "discount": {
146 * "appliedCoupon": {
147 * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1",
148 * "couponId": "558b511f-6eb7-82d3-53fca7374dfa",
149 * "name": "Summer sale"
150 * }
151 * }
152 * // The following field is only present when
153 * // the order is a subscription
154 * "subscriptionInfo": {
155 * "id": "6b320feb-ddde-45be-950b-8ed277033579",
156 * "cycleNumber": 1,
157 * "subscriptionSettings": {
158 * "frequency": "MONTH",
159 * "autoRenewal": false,
160 * "billingCycles": 3
161 * },
162 * "subscriptionOptionInfo": {
163 * "id": "17c145c2-5d23-42c3-ac0a-e579e99c67fd",
164 * "title": "Coffee of the month",
165 * "description": "Monthly Coffee Sub"
166 * }
167 * }
168 * }
169 *
170 */