Search.../

markAsPaid( )

Developer Preview

Marks an offline order as paid.

Description

The markAsPaid() function returns a Promise that resolves when the offline order is successfully marked as paid.

The entire order is marked as paid, even if the order's payments are recurring.

Note: Marking separate payment cycles as paid is not yet supported. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.

Marking an offline order as paid causes the following changes:

  • The order's lastPaymentStatus changes to "PAID".
  • The order's status changes to either "PENDING" or "ACTIVE", depending on the order's startDate.

An error occurs if you attempt to:

  • Mark an already-paid, offline order as paid. You cannot make an offline order as paid twice.
  • Mark an online order as paid. The markAsPaid() function is supported for offline orders only.
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function markAsPaid(_id: string): Promise<void>

markAsPaid Parameters

NAME
TYPE
DESCRIPTION
_id
string

Order ID.

Returns

Fulfilled - When the order is marked as paid.

Return Type:

Promise<
void
>

Was this helpful?

Mark an order as paid

Copy Code
1import { orders } from 'wix-pricing-plans.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample _id value: '82d99338-5653-459a-a751-b57483f7cfb5' */
5
6const elevatedMarkAsPaid = elevate(orders.markAsPaid);
7
8export async function myMarkAsPaidFunction(_id) {
9 try {
10 await elevatedMarkAsPaid(_id);
11
12 return;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to void */