Search...
createOfflineOrder( )
Creates an order for a buyer who purchased the plan with an offline transaction.
Description
The createOfflineOrder()
function returns a Promise that resolves to an order
object when the order has been created.
Payment of an offline order is handled in 1 of 2 ways.
- When creating the order, select
true
in thepaid
request parameter. - After creation, with the
markAsPaid()
function.
When creating a non-free offline order:
- The order's status is set to
"PENDING"
if the start date is in the future. Otherwise, the status is set to"ACTIVE"
.
The order's last payment status is set to "UNPAID"
or "PAID"
.
When creating a free offline order:
- The order's status is set to
"PENDING"
if the start date is in the future. Otherwise, the status is set to"ACTIVE"
. - The order's last payment status is set to
"NOT_APPLICABLE"
.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function createOfflineOrder(planId: string, options: CreateOfflineOrderOptions): Promise<CreateOfflineOrderResponse>
createOfflineOrder Parameters
NAME
TYPE
DESCRIPTION
options
Optional
CreateOfflineOrderOptions
Options for creating an offline order.
Returns
Fulfilled - The order of the plan.
Return Type:
Promise<
CreateOfflineOrderResponse
>NAME
TYPE
DESCRIPTION
order
Order
Order.
Was this helpful?
createOfflineOrder example
Copy Code
1import { orders } from 'wix-pricing-plans.v2';23 async function createOfflineOrder(planId, options) {4 try {5 const result = await orders.createOfflineOrder(planId, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13