Search...
onOrderRefunded( )
An event that fires when an order is refunded.
Description
The onOrderRefunded()
event handler runs when an order is refunded. For example, when an order is refunded in your site's Dashboard.
Note: Backend events don't work when previewing your site.
Syntax
function onOrderRefunded(event: OrderRefundedEvent): void
onOrderRefunded Parameters
NAME
TYPE
DESCRIPTION
event
OrderRefundedEvent
Order refunded event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when an order is refunded
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.34export function wixStores_onOrderRefunded(event) {5 const refundedOrderId = event.order._id;6 const refundId = event.refundId7}89/* Full event object:10 *11 * {12 * "refundId": "0bf46037-de62-7848-af43-3a7f3c28b041",13 * "order": {14 * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447",15 * "_updatedDate": "2020-05-27T12:20:37.994Z",16 * "buyerLanguage": "en",17 * "cartId": "74621781-b3hf-7845-8c9e-09879063da9",18 * "channelInfo": {19 * "type": "WEB"20 * },21 * "enteredBy": {22 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",23 * "identityType": "MEMBER"24 * },25 * "refunds": [26 * {27 * "id": "0bf46037-de62-7848-af43-3a7f3c28b041",28 * "dateCreated": "2020-12-14T13:02:04.557Z",29 * "amount": "50",30 * "externalRefund": true,31 * "reason": "returned"32 * }33 * ],34 * "billingInfo": {35 * "address": {36 * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555",37 * "city": "New York",38 * "country": "USA",39 * "addressLine": "235 W 23rd St",40 * "postalCode": "10011",41 * "subdivision": "NY"42 * },43 * "firstName": "John",44 * "lastName": "Doe",45 * "email": "john.doe@somedomain.com",46 * "phone": "+15555555555",47 * "company": "My company name",48 * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb",49 * "paidDate": "2020-05-27T12:20:37.994Z",50 * "paymentMethod": "VISA",51 * "paymentGatewayTransactionId": "29A06193U6234935D",52 * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb"53 * },54 * "buyerInfo": {55 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",56 * "identityType": "MEMBER",57 * "firstName": "John",58 * "lastName": "Doe",59 * "phone": "+15555555555",60 * "email": "john.doe@somedomain.com"61 * },62 * "_dateCreated": "2020-05-27T12:20:37.966Z",63 * "currency": "USD",64 * "fulfillmentStatus": "CANCELED",65 * "archived": false,66 * "activities": [67 * {68 * "type": "ORDER_PLACED",69 * "timestamp": "2020-05-27T12:20:37.966Z"70 * },71 * {72 * "type": "ORDER_PAID",73 * "timestamp": "2020-05-27T12:20:37.994Z"74 * }75 * ],76 * "number": 10019,77 * "paymentStatus": "FULLY_REFUNDED",78 * "shippingInfo": {79 * "deliveryOption": "Free Shipping",80 * "estimatedDeliveryTime": "4:30pm",81 * "shippingRegion": "Domestic",82 * "shipmentDetails": {83 * "address": {84 * "formatted": "235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555",85 * "city": "New York",86 * "country": "USA",87 * "addressLine": "235 W 23rd St",88 * "postalCode": "10011",89 * "subdivision": "NY"90 * },91 * "firstName": "John",92 * "lastName": "Doe",93 * "email": "john.doe@somedomain.com",94 * "phone": "5555555555",95 * "company": "company name",96 * "tax": 0,97 * "discount": 0,98 * "priceData": {99 * "price": 0,100 * "taxIncludedInPrice": false101 * },102 * },103 * "pickupDetails": null104 * },105 * "lineItems": [106 * {107 * "index": 1,108 * "quantity": 1,109 * "price": 50,110 * "name": "my product's name",111 * "translatedName": "Nombre traducido",112 * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea",113 * "totalPrice": 5,114 * "lineItemType": "PHYSICAL",115 * "options": [116 * {117 * "option": "Size",118 * "selection": "Medium"119 * }120 * ],121 * "customTextFields": [122 * {123 * "title": "Notes for delivery",124 * "value": "Please leave at front door"125 * }126 * ],127 * "weight": 1.42,128 * "sku": "36523641234523",129 * "discount": 0,130 * "tax": 5,131 * "taxIncludedInPrice": true,132 * "priceData": {133 * "price": "50",134 * "totalPrice": 50,135 * "taxIncludedInPrice": true136 * },137 * "mediaItem": {138 * "altText": "This is a description of the image",139 * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg",140 * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899",141 * "type": "IMAGE"142 * }143 * }144 * ],145 * "totals": {146 * "discount": 0,147 * "quantity": 1,148 * "shipping": 0,149 * "subtotal": 50,150 * "tax": 0,151 * "total": 50,152 * "weight": 1.42153 * },154 * "weightUnit": "KG",155 * "customField": {156 * "value": "Please call when outside",157 * "title": "Notes for delivery",158 * "translatedTitle": "Notas de entrega"159 * },160 * "discount": {161 * "appliedCoupon": {162 * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1",163 * "couponId": "558b511f-6eb7-82d3-53fca7374dfa",164 * "name": "Summer sale - Free Shipping"165 * }166 * }167 * }168 * }169 *170 */