Search...
markCheckoutAsCompleted( )
Marks a checkout as completed - checkout.complete
boolean is set to true
.
Description
The markCheckoutAsCompleted()
function returns a Promise that resolves when the specified checkout is marked as completed.
Authorization
Request
This endpoint does not take any parameters
Response Object
Returns an empty object.
Status/Error Codes
Was this helpful?
Mark a checkout as completed
Copy Code
1/**************************************2 * Backend code - my-backend-file.jsw *3 *************************************/45import { checkout } from 'wix-ecom-backend';67export async function myMarkCheckoutAsCompletedFunction(checkoutId) {8 try {9 await checkout.markCheckoutAsCompleted(checkoutId);10 console.log('Success! Checkout marked as completed');11 return;12 } catch (error) {13 console.error(error);14 // Handle the error15 }16}1718/*************19 * Page code *20 ************/2122import { myMarkCheckoutAsCompletedFunction } from 'backend/my-backend-file';2324// Sample checkoutId:25const checkoutId = '96a61a4b-6b61-47d1-a039-0213a8230ccd';2627myMarkCheckoutAsCompletedFunction(checkoutId)28 .then(() => {29 console.log('Success! Checkout marked as completed');30 return;31 })32 .catch((error) => {33 console.error(error);34 // Handle the error35 });36
Mark a checkout as completed (export from backend code)
Copy Code
1/**************************************2 * Backend code - my-backend-file.web.js *3 *************************************/45import { Permissions, webMethod } from 'wix-web-module';6import { checkout } from 'wix-ecom-backend';78export const myMarkCheckoutAsCompletedFunction = webMethod(Permissions.Anyone, async (checkoutId) => {9 try {10 await checkout.markCheckoutAsCompleted(checkoutId);11 console.log('Success! Checkout marked as completed');12 return;13 } catch (error) {14 console.error(error);15 // Handle the error16 }17});1819/*************20 * Page code *21 ************/2223import { myMarkCheckoutAsCompletedFunction } from 'backend/my-backend-file.web';2425// Sample checkoutId:26const checkoutId = '96a61a4b-6b61-47d1-a039-0213a8230ccd';2728myMarkCheckoutAsCompletedFunction(checkoutId)29 .then(() => {30 console.log('Success! Checkout marked as completed');31 return;32 })33 .catch((error) => {34 console.error(error);35 // Handle the error36 });3738