Search.../

markAsPaid( )

Marks an offline pricing plan 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 mark an offline order as paid twice.
  • Mark an online order as paid. The markAsPaid() function is supported for offline orders only.

The onOrderMarkedAsPaid() and onOrderUpdated() event handlers run when an offline order is marked as paid.

Note: Only site visitors with the Manage Pricing Plans and Manage Subscriptions permissions can mark offline orders as paid. You can override the permissions by setting the function's suppressAuth option to true.

Syntax

function markAsPaid(orderId: string, [options: Options]): Promise<void>

markAsPaid Parameters

NAME
TYPE
DESCRIPTION
orderId
string

ID of the order being marked as paid.

options
Optional
Options

Options to use when marking an order as paid.

Returns

Fulfilled - When the order is marked as paid.

Return Type:

Promise<void>

Was this helpful?

Mark an offline order as paid

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4// Sample orderId value: '19b28b41-1ef2-42dc-afaa-9dc1854d0191'
5
6export const myMarkAsPaidFunction = webMethod(Permissions.Anyone, async (orderId) => {
7 try {
8 const order = await orders.markAsPaid(orderId);
9
10 return order;
11 } catch (error) {
12 console.error(error);
13 }
14});
15
16// Returns a promise that resolves to void
Mark an offline order as paid, bypassing permission checks

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4/* Sample orderId value: '895fd8d9-f732-444f-a82b-19f7e55e9617'
5 *
6 * Sample options object:
7 * {
8 * suppressAuth : true
9 * }
10 */
11
12export const myMarkAsPaidWithOptionsFunction = webMethod(Permissions.Anyone, async (orderId, options) => {
13 try {
14 const order = await orders.markAsPaid(orderId, options);
15
16 return order;
17 } catch (error) {
18 console.error(error);
19 }
20});
21
22// Returns a promise that resolves to void