onCheckoutCompleted( )


An event that triggers when a checkout is completed. This happens either when an order is created from a checkout, or after using markCheckoutAsCompleted().

The onCheckoutCompleted() event handler runs when a checkout is completed. The received CheckoutCompleted object contains information about the checkout that was completed and event metadata.

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

Method Declaration
Copy
function wixEcom_onCheckoutCompleted(event: CheckoutCompleted): void;
Method Parameters
eventCheckoutCompleted

Information about the checkout that was completed and event metadata.

An event fired when a checkout is completed
JavaScript
// Place this code in the events.js file // of your site's Backend section. // Add the file if it doesn't exist. export function wixEcom_onCheckoutCompleted(event) { const checkoutSubtotal = event.entity.subtotal.amount; const checkoutId = event.entity._id; const checkoutComplete = event.entity.completed; const eventId = event.metadata.id; console.log("Checkout completed", event); } /* Full event object: * * { * "metadata": { * "id": "d94b500b-3906-434f-bd90-92c521e4f0e3", * "entityId": "81b73bc6-d403-4afe-8464-226f9505b1c2", * "eventTime": "2022-10-27T11:58:12.667470Z", * "triggeredByAnonymizeRequest": false * }, * "data": { * "checkout": { * "_id": "81b73bc6-d403-4afe-8464-226f9505b1c2", * "lineItems": [ * { * "_id": "00000000-0000-0000-0000-000000000001", * "quantity": 3, * "catalogReference": { * "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a", * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e" * }, * "productName": { * "original": "Shirt", * "translated": "Shirt" * }, * "url": "https://example.wixsite.com", * "price": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "lineItemPrice": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "fullPrice": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "priceBeforeDiscounts": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "totalPriceAfterTax": { * "amount": "20", * "convertedAmount": "20", * "formattedAmount": "$20.00", * "formattedConvertedAmount": "$20.00" * }, * "totalPriceBeforeTax": { * "amount": "20", * "convertedAmount": "20", * "formattedAmount": "$20.00", * "formattedConvertedAmount": "$20.00" * }, * "taxDetails": { * "taxableAmount": { * "amount": "20", * "convertedAmount": "20", * "formattedAmount": "$20.00", * "formattedConvertedAmount": "$20.00" * }, * "taxRate": "0", * "totalTax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "rateBreakdown": [] * }, * "discount": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "descriptionLines": [], * "media": "wix:image://v1/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg#originWidth=1000&originHeight=1000", * "availability": { * "status": "AVAILABLE" * }, * "physicalProperties": { * "sku": "364115376135191", * "shippable": true * }, * "couponScopes": [ * { * "namespace": "stores", * "group": { * "name": "collection", * "entityId": "00000000-000000-000000-000000000001" * } * }, * { * "namespace": "stores", * "group": { * "name": "product", * "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a" * } * } * ], * "itemType": { * "preset": "PHYSICAL" * }, * "paymentOption": "FULL_PAYMENT_ONLINE", * "rootCatalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a" * } * ], * "shippingInfo": { * "carrierServiceOptions": [] * }, * "buyerInfo": { * "contactId": "f7dc17a6-825a-466e-a78e-c4abea0217db", * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873" * }, * "conversionCurrency": "USD", * "priceSummary": { * "subtotal": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "shipping": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "tax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "discount": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "total": { * "amount": "20", * "convertedAmount": "20", * "formattedAmount": "$20.00", * "formattedConvertedAmount": "$20.00" * }, * "additionalFees": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * } * }, * "calculationErrors": { * "orderValidationErrors": [] * }, * "appliedDiscounts": [ * { * "discountType": "GLOBAL", * "lineItemIds": [], * "coupon": { * "_id": "fbb94b06-7447-4161-9c48-59bfcdc39e77", * "code": "SUMMERSALE10", * "amount": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "name": "SUMMERSALE10", * "couponType": "MoneyOff" * } * } * ], * "customFields": [], * "weightUnit": "KG", * "currency": "USD", * "channelType": "WEB", * "siteLanguage": "en", * "buyerLanguage": "en", * "completed": true, * "taxIncludedInPrice": false, * "createdBy": { * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873" * }, * "_createdDate": "2022-10-27T11:42:17.059Z", * "_updatedDate": "2022-10-27T11:58:12.657Z", * "payNow": { * "subtotal": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "shipping": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "tax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "discount": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "total": { * "amount": "20", * "convertedAmount": "20", * "formattedAmount": "$20.00", * "formattedConvertedAmount": "$20.00" * }, * "additionalFees": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * } * }, * "payLater": { * "subtotal": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "shipping": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "tax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "discount": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "total": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "additionalFees": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * } * }, * "membershipOptions": { * "eligibleMemberships": [], * "invalidMemberships": [], * "selectedMemberships": { * "memberships": [] * } * }, * "additionalFees": [] * } * } * } * */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCheckoutCreated( )


An event that triggers when a new checkout is created. For example, when a checkout is created from a cart or after using createCheckout().

The onCheckoutCreated() event handler runs when a new checkout is created. The received CheckoutCreated object contains information about the checkout that was created and event metadata.

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

Method Declaration
Copy
Method Parameters
eventCheckoutCreated

Information about the checkout that was created and event metadata.

An event fired when a checkout is created
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCheckoutUpdated( )


An event that triggers when a checkout is updated. A checkout is updated when, for example, items are added or a coupon is removed.

The onCheckoutUpdated() event handler runs when a new checkout is updated. The received CheckoutUpdated object contains information about the checkout that was updated and event metadata.

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

Method Declaration
Copy
Method Parameters
eventCheckoutUpdated

Information about the checkout that was updated and event metadata.

An event fired when a checkout is updated
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCheckoutSettingsUpdated( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when checkout settings are updated.

The onCheckoutSettingsUpdated() event handler runs when checkout settings are updated. The received CheckoutSettingsUpdated object contains information about the checkout settings that were updated and event metadata.

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

Method Declaration
Copy
Method Parameters
eventCheckoutSettingsUpdated

Information about the checkout settings that were updated and event metadata.

onCheckoutSettingsUpdated example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCheckoutTemplateCreated( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a checkout template is created.

The onCheckoutTemplateCreated() event handler runs when a checkout template is created. The received CheckoutTemplateCreated object contains information about the checkout template that was created and event metadata.

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

Method Declaration
Copy
Method Parameters
eventCheckoutTemplateCreated

Information about the checkout template that was created and event metadata.

onCheckoutTemplateCreated example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCheckoutTemplateDeleted( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a checkout template is deleted.

The onCheckoutTemplateDeleted() event handler runs when a checkout template is deleted. The received CheckoutTemplateDeleted object contains information about the checkout template that was deleted and event metadata.

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

Method Declaration
Copy
Method Parameters
eventCheckoutTemplateDeleted

Information about the checkout template that was deleted and event metadata.

onCheckoutTemplateDeleted example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?