Introduction

With Events Policies APIs, you can manage the policies for a particular event. For example, you can create, update, and delete policies. You can also reorder policies in the Event Dashboard and checkout form.

Policies define terms & conditions for the events, such as terms for canceling attendance, transferring a ticket to another person, and so on. For example: "Participants are entitled to a 100% refund if canceling attendance 1 week prior to the event. After this date, participants will be refunded 50% of the ticket price."

A policy agreement checkbox will be added to the RSVP or checkout form. The policy text can be read in a pop-up window if you click the policy name. By default, there are no policies when you first create an event.

Terminology

  • Policy: text that defines terms & conditions, as relevant.
  • Event Dashboard: controls center which allows users to manage their site events settings and features.
  • Checkout form: the final step in the ticket purchasing process where the customer fills in personal info, reads policies and pays money.
Was this helpful?
Yes
No

Setup

To use the Policies API, install the @wix/events package using npm or Yarn:

Copy
1
npm install @wix/events

or

Copy
1
yarn add @wix/events

Then import { policies } from @wix/events:

Copy
1
import { policies } from '@wix/events'
Was this helpful?
Yes
No

createPolicy( )

Creates a policy.

The createPolicy() function returns a Promise that resolves to the newly-created policy.

You can create up to 3 policies per event. If you try to create more than 3, you'll get the "Maximum number of policies for the event has been reached" error.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Manage Policies
Learn more about permission scopes.
Copy
function createPolicy(policy: Policy): Promise<Policy>
Method Parameters
policyPolicyRequired
Policy info.
Returns
Return Type:Promise<Policy>
Was this helpful?
Yes
No

deletePolicy( )

Permanently deletes a policy.

The deletePolicy() function returns a Promise that resolves when the specified policy is deleted.

Deleted policies are not returned by the getPolicy() or queryPolicies() functions.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Manage Policies
Learn more about permission scopes.
Copy
function deletePolicy(policyId: string): Promise<void>
Method Parameters
policyIdstringRequired
ID of the policy to delete.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No

getPolicy( )

Retrieves a policy by ID.

The getPolicy() function returns a Promise that resolves to a policy whose ID matches the given ID.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Read Policies
Manage Policies
Learn more about permission scopes.
Copy
function getPolicy(policyId: string): Promise<Policy>
Method Parameters
policyIdstringRequired
Policy ID.
Returns
Return Type:Promise<Policy>
Was this helpful?
Yes
No

queryPolicies( )

Creates a query to retrieve a list of policies, given the provided paging and filter.

The queryPolicies() function builds a query to retrieve a list of policies and returns a PoliciesQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining PoliciesQueryBuilder functions onto the query. PoliciesQueryBuilder functions enable you to sort, filter and control the results that PoliciesQueryBuilder.find() returns.

The query runs with the following PoliciesQueryBuilder defaults that you can override:

limit: 50
descending: _createdDate

The functions that are chained to queryPolicies() are applied in the order they are called. For example, if you sort on the _createdDate property in ascending order and then on the id property in descending order, the results are sorted by the created date and then, if there are multiple results with the same date, the items are sorted by the id.

The table below shows which PoliciesQueryBuilder functions are supported for queryPoliciesGuests(). You can only use one filter function for each property. If a property is used in more than one filter, only the first filter will work.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),in(),exists(),ascending(),descending()
revisioneq(),ne(),in(),lt(),le(),gt(),ge(),exists(),ascending(),descending()
_createdDateeq(),ne(),in(),lt(),le(),gt(),ge(),exists(),ascending(),descending()
_updatedDateeq(),ne(),in(),lt(),le(),gt(),ge(),exists(),ascending(),descending()
nameeq(),ne(),in(),exists(),ascending(),descending()
bodyeq(),ne(),in(),exists(),ascending(),descending()
eventIdeq(),ne(),in(),exists(),ascending(),descending()

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Read Policies
Manage Policies
Learn more about permission scopes.
Copy
function queryPolicies(): PoliciesQueryBuilder
Request
This method does not take any parameters
Returns
Was this helpful?
Yes
No

reorderEventPolicies( )

Changes policy order in an event dashboard and agreement checkbox on the checkout form. For example, if we have 3 policies in the list, after using this function the 3rd policy will become the 1st, and other policies will move by 1 position. By default, the policies are arranged by the created date in descending order.

Note: it is possible to use both beforePolicyId and afterPolicyId at the same time but only the last one defined will be executed.

The reorderEventPolicies() function returns a Promise that resolves to the newly-reordered policy.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Manage Policies
Learn more about permission scopes.
Copy
function reorderEventPolicies(policyId: string, eventId: string, options: ReorderEventPoliciesOptions): Promise<ReorderEventPoliciesResponse>
Method Parameters
policyIdstringRequired
Event policy ID.

eventIdstringRequired
Event ID.

optionsReorderEventPoliciesOptions
Options for Reorder Event Policies function.
Returns
Return Type:Promise<ReorderEventPoliciesResponse>
Was this helpful?
Yes
No

updatePolicy( )

Updates a policy.

The updatePolicy() function returns a Promise that resolves to the newly-updated policy.

Each time the policy is updated, revision increments by 1. The existing revision must be included when updating the policy. This ensures you're working with the latest policy and prevents unintended overwrites.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Events - all permissions
Manage Policies
Learn more about permission scopes.
Copy
function updatePolicy(_id: string, policy: UpdatePolicy): Promise<Policy>
Method Parameters
_idstringRequired
Policy ID.

policyUpdatePolicyRequired
Policy to update.
Returns
Return Type:Promise<Policy>
Was this helpful?
Yes
No