Marks a checkout as completed - checkout.complete
boolean is set to true
.
The markCheckoutAsCompleted()
function returns a Promise that resolves when the specified checkout is marked as completed.
function markCheckoutAsCompleted(_id: string): Promise<void>;
Checkout ID.
/**************************************
* Backend code - my-backend-file.jsw *
*************************************/
import { checkout } from "wix-ecom-backend";
export async function myMarkCheckoutAsCompletedFunction(checkoutId) {
try {
await checkout.markCheckoutAsCompleted(checkoutId);
console.log("Success! Checkout marked as completed");
return;
} catch (error) {
console.error(error);
// Handle the error
}
}
/*************
* Page code *
************/
import { myMarkCheckoutAsCompletedFunction } from "backend/my-backend-file";
// Sample checkoutId:
const checkoutId = "96a61a4b-6b61-47d1-a039-0213a8230ccd";
myMarkCheckoutAsCompletedFunction(checkoutId)
.then(() => {
console.log("Success! Checkout marked as completed");
return;
})
.catch((error) => {
console.error(error);
// Handle the error
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.