> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# PreparePayment

# Package: onlinePrograms

# Namespace: JoinApplicationsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/prepare-payment.md

## Permission Scopes:
Manage Online Programs: SCOPE.CHALLENGES.MANAGE
Manage Online Programs: SCOPE.CHALLENGES.MANAGE

## Introduction

Prepares payment for a join application, or resolves an existing Pricing Plans entitlement.

Before creating or refreshing checkout details, the method checks whether the member already has an eligible Pricing Plans entitlement for the program. If so, it returns the join application with `paymentStatus` set to `PAYMENT_SUCCESSFUL` and the eligible plan IDs in `paymentInfo.paidPlanIds`. No checkout is needed, even when the application was previously in `PAYMENT_PENDING`.

If no eligible entitlement exists, `paymentStatus` must be `PAYMENT_PENDING`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. Calling the method for `PAYMENT_FAILED` or `PAYMENT_CANCELED` retries payment by replacing stale payment details with newly prepared ones.

Specify `paymentType` to choose the flow:

- `SINGLE_PAYMENT`: Creates a Wix Payments order and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`.
- `PAID_PLANS`: Validates that pricing plans are connected to the program and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`.

Check the returned `paymentStatus` before starting checkout, and direct the member to checkout only when it's `PAYMENT_IN_PROGRESS`. To apply a discount before the member completes a Wix Payments checkout, call [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).

---

## REST API

### Schema

```
 Method: preparePayment
 Description: Prepares payment for a join application, or resolves an existing Pricing Plans entitlement.  Before creating or refreshing checkout details, the method checks whether the member already has an eligible Pricing Plans entitlement for the program. If so, it returns the join application with `paymentStatus` set to `PAYMENT_SUCCESSFUL` and the eligible plan GUIDs in `paymentInfo.paidPlanIds`. No checkout is needed, even when the application was previously in `PAYMENT_PENDING`.  If no eligible entitlement exists, `paymentStatus` must be `PAYMENT_PENDING`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. Calling the method for `PAYMENT_FAILED` or `PAYMENT_CANCELED` retries payment by replacing stale payment details with newly prepared ones.  Specify `paymentType` to choose the flow:  - `SINGLE_PAYMENT`: Creates a Wix Payments order and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`. - `PAID_PLANS`: Validates that pricing plans are connected to the program and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`.  Check the returned `paymentStatus` before starting checkout, and direct the member to checkout only when it's `PAYMENT_IN_PROGRESS`. To apply a discount before the member completes a Wix Payments checkout, call [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).
 URL: https://www.wixapis.com/online-programs/participants/v3/join-applications/{joinApplicationId}/prepare-payment
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  paymentType
 Method parameters: 
   param name: paymentType | type: PaymentType   | required: true 
      - enum:
           SINGLE_PAYMENT - One-time payment through Wix Payments.
           PAID_PLANS - Payment through Wix Pricing Plans.
 Return type: PreparePaymentResponse
  - name: joinApplication | type: JoinApplication | description: Join application with refreshed payment info. Check `paymentStatus` before directing the member to checkout.  
     - name: id | type: string | description: Join application GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time a lifecycle, payment, or tag action changes the join application.  This API doesn't provide a generic update method, so `revision` is read-only. Don't specify it when creating or changing a join application.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the join application was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the join application was last updated.  | read-only: true | validation: format date-time
     - name: memberId | type: string | description: GUID of the site member applying or invited to participate in the program.  Required when a Wix user creates an application on a member's behalf. Automatically set to the caller's member GUID when a member creates their own application.  | read-only: true | validation: format GUID
     - name: programId | type: string | description: GUID of the program the join application is for.  | validation: format GUID, immutable
     - name: status | type: Status | description: Current status of the join application.  Read-only for member-initiated applications. A Wix user can set the initial status when creating an application on a member's behalf.  | read-only: true 
         - enum:
         -     INVITED: Member has been invited to join the program and has not yet accepted.
         -     APPROVAL_PENDING: Member's application is awaiting the Wix user's decision.
         -     APPROVED: Application is approved. Payment may still be required before the member is enrolled.
         -     CANCELLED: Member canceled the application. The join application is removed asynchronously.
         -     DECLINED: Wix user declined the application. The join application is removed asynchronously.
         -     SUSPENDED: Connected participant is suspended after the related Pricing Plans subscription expires. A successful new payment resumes the participation flow.
     - name: paymentStatus | type: PaymentStatus | description: Payment status of the join application.  | read-only: true 
         - enum:
         -     NO_PAYMENT_REQUIRED: Payment isn't required because the program is free or the member has an eligible Pricing Plans entitlement.
         -     PAYMENT_PENDING: Payment is required before the member can be enrolled.
         -     PAYMENT_IN_PROGRESS: Payment checkout or a Pricing Plans purchase is in progress.
         -     PENDING_OWNER_APPROVAL: Member submitted an offline payment that awaits the Wix user's decision.
         -     PAYMENT_SUCCESSFUL: Payment completed successfully.
         -     PAYMENT_FAILED: Payment was declined by the payment system or, for an offline payment, by the Wix user.
         -     PAYMENT_CANCELED: Member canceled payment.
     - name: paymentInfo | type: PaymentInfo | description: Wix Payments or Pricing Plans data associated with the join application.  | read-only: true 
        - name: paymentOrderId | type: string | description: Wix Payments order GUID. Populated when the member selects one-time payment at checkout.  | read-only: true | validation: format GUID
        - name: offlineTransactionId | type: string | description: Offline transaction GUID. Populated when the member selects manual payment at checkout.  | read-only: true | validation: format GUID
        - name: paidPlanIds | type: array<string> | description: IDs of the pricing plans connected to the program. Populated when the member selects Pricing Plans at checkout.  | read-only: true | validation: maxItems 100, format GUID
        - name: couponId | type: string | description: GUID of the coupon applied to the payment order. Populated when a coupon is applied with [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).  | read-only: true | validation: format GUID
     - name: member | type: Member | description: Snapshot of the member identified by `memberId`, copied from the Members API. It isn't the authoritative member record.  | read-only: true 
        - name: firstName | type: string | description: Member contact's first name.  | read-only: true | validation: maxLength 1000
        - name: lastName | type: string | description: Member contact's last name.  | read-only: true | validation: maxLength 1000
        - name: email | type: string | description: Member's login email.  | read-only: true | validation: format EMAIL
        - name: contactId | type: string | description: Member's contact GUID.  | read-only: true | validation: format GUID
        - name: nickname | type: string | description: Member's nickname.  | read-only: true | validation: maxLength 1000
        - name: profileImageUrl | type: string | description: URL of the member's profile image.  | read-only: true | validation: format WEB_URL
     - name: participantId | type: string | description: GUID of the participant created from the join application.  Populated when `status` is `APPROVED` and `paymentStatus` is `NO_PAYMENT_REQUIRED` or `PAYMENT_SUCCESSFUL`.  | read-only: true | validation: format GUID
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the join application object.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
     - name: tags | type: Tags | description: Tags for categorizing and organizing join applications.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, typically restricted from site members and visitors.  
           - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
        - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: NO_PAID_PLAN_CONNECTED | Description: No paid plan is connected to the program.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: INVALID_PAYMENT_STATUS | Description: The join application's `paymentStatus` doesn't permit preparing payment. Allowed from `PAYMENT_PENDING`, `PAYMENT_FAILED`, and `PAYMENT_CANCELED`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PP_APP_NOT_INSTALLED | Description: Pricing Plans isn't installed on the site.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: OP_APP_NOT_INSTALLED | Description: Online Programs isn't installed on the site.


```

### Examples

### Prepare single payment
Initiates a single payment process for a join application

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/participants/v3/join-applications/4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4/prepare-payment' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "paymentType": "SINGLE_PAYMENT"
}'
```

### Prepare paid plans payment
Initiates a paid plans payment process for a join application

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/participants/v3/join-applications/6d8c2f30-69f6-4484-a836-6d70a6e3f902/prepare-payment' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "paymentType": "PAID_PLANS"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.joinApplications.preparePayment(joinApplicationId, paymentType)
 Description: Prepares payment for a join application, or resolves an existing Pricing Plans entitlement.  Before creating or refreshing checkout details, the method checks whether the member already has an eligible Pricing Plans entitlement for the program. If so, it returns the join application with `paymentStatus` set to `PAYMENT_SUCCESSFUL` and the eligible plan GUIDs in `paymentInfo.paidPlanIds`. No checkout is needed, even when the application was previously in `PAYMENT_PENDING`.  If no eligible entitlement exists, `paymentStatus` must be `PAYMENT_PENDING`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. Calling the method for `PAYMENT_FAILED` or `PAYMENT_CANCELED` retries payment by replacing stale payment details with newly prepared ones.  Specify `paymentType` to choose the flow:  - `SINGLE_PAYMENT`: Creates a Wix Payments order and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`. - `PAID_PLANS`: Validates that pricing plans are connected to the program and sets `paymentStatus` to `PAYMENT_IN_PROGRESS`.  Check the returned `paymentStatus` before starting checkout, and direct the member to checkout only when it's `PAYMENT_IN_PROGRESS`. To apply a discount before the member completes a Wix Payments checkout, call [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  joinApplicationId, paymentType
 Method parameters: 
   param name: joinApplicationId | type: string | description: GUID of the join application to prepare payment for. | required: true | validation: format GUID
   param name: paymentType | type: PaymentType   | required: true 
      - enum:
           SINGLE_PAYMENT - One-time payment through Wix Payments.
           PAID_PLANS - Payment through Wix Pricing Plans.
 Return type: PROMISE<PreparePaymentResponse>
  - name: joinApplication | type: JoinApplication | description: Join application with refreshed payment info. Check `paymentStatus` before directing the member to checkout.  
     - name: _id | type: string | description: Join application GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time a lifecycle, payment, or tag action changes the join application.  This API doesn't provide a generic update method, so `revision` is read-only. Don't specify it when creating or changing a join application.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the join application was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the join application was last updated.  | read-only: true 
     - name: memberId | type: string | description: GUID of the site member applying or invited to participate in the program.  Required when a Wix user creates an application on a member's behalf. Automatically set to the caller's member GUID when a member creates their own application.  | read-only: true | validation: format GUID
     - name: programId | type: string | description: GUID of the program the join application is for.  | validation: format GUID, immutable
     - name: status | type: Status | description: Current status of the join application.  Read-only for member-initiated applications. A Wix user can set the initial status when creating an application on a member's behalf.  | read-only: true 
         - enum:
         -     INVITED: Member has been invited to join the program and has not yet accepted.
         -     APPROVAL_PENDING: Member's application is awaiting the Wix user's decision.
         -     APPROVED: Application is approved. Payment may still be required before the member is enrolled.
         -     CANCELLED: Member canceled the application. The join application is removed asynchronously.
         -     DECLINED: Wix user declined the application. The join application is removed asynchronously.
         -     SUSPENDED: Connected participant is suspended after the related Pricing Plans subscription expires. A successful new payment resumes the participation flow.
     - name: paymentStatus | type: PaymentStatus | description: Payment status of the join application.  | read-only: true 
         - enum:
         -     NO_PAYMENT_REQUIRED: Payment isn't required because the program is free or the member has an eligible Pricing Plans entitlement.
         -     PAYMENT_PENDING: Payment is required before the member can be enrolled.
         -     PAYMENT_IN_PROGRESS: Payment checkout or a Pricing Plans purchase is in progress.
         -     PENDING_OWNER_APPROVAL: Member submitted an offline payment that awaits the Wix user's decision.
         -     PAYMENT_SUCCESSFUL: Payment completed successfully.
         -     PAYMENT_FAILED: Payment was declined by the payment system or, for an offline payment, by the Wix user.
         -     PAYMENT_CANCELED: Member canceled payment.
     - name: paymentInfo | type: PaymentInfo | description: Wix Payments or Pricing Plans data associated with the join application.  | read-only: true 
        - name: paymentOrderId | type: string | description: Wix Payments order GUID. Populated when the member selects one-time payment at checkout.  | read-only: true | validation: format GUID
        - name: offlineTransactionId | type: string | description: Offline transaction GUID. Populated when the member selects manual payment at checkout.  | read-only: true | validation: format GUID
        - name: paidPlanIds | type: array<string> | description: IDs of the pricing plans connected to the program. Populated when the member selects Pricing Plans at checkout.  | read-only: true | validation: maxItems 100, format GUID
        - name: couponId | type: string | description: GUID of the coupon applied to the payment order. Populated when a coupon is applied with [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).  | read-only: true | validation: format GUID
     - name: member | type: Member | description: Snapshot of the member identified by `memberId`, copied from the Members API. It isn't the authoritative member record.  | read-only: true 
        - name: firstName | type: string | description: Member contact's first name.  | read-only: true | validation: maxLength 1000
        - name: lastName | type: string | description: Member contact's last name.  | read-only: true | validation: maxLength 1000
        - name: email | type: string | description: Member's login email.  | read-only: true | validation: format EMAIL
        - name: contactId | type: string | description: Member's contact GUID.  | read-only: true | validation: format GUID
        - name: nickname | type: string | description: Member's nickname.  | read-only: true | validation: maxLength 1000
        - name: profileImageUrl | type: string | description: URL of the member's profile image.  | read-only: true | validation: format WEB_URL
     - name: participantId | type: string | description: GUID of the participant created from the join application.  Populated when `status` is `APPROVED` and `paymentStatus` is `NO_PAYMENT_REQUIRED` or `PAYMENT_SUCCESSFUL`.  | read-only: true | validation: format GUID
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the join application object.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
     - name: tags | type: Tags | description: Tags for categorizing and organizing join applications.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, typically restricted from site members and visitors.  
           - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
        - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: NO_PAID_PLAN_CONNECTED | Description: No paid plan is connected to the program.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: INVALID_PAYMENT_STATUS | Description: The join application's `paymentStatus` doesn't permit preparing payment. Allowed from `PAYMENT_PENDING`, `PAYMENT_FAILED`, and `PAYMENT_CANCELED`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PP_APP_NOT_INSTALLED | Description: Pricing Plans isn't installed on the site.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: OP_APP_NOT_INSTALLED | Description: Online Programs isn't installed on the site.


```

### Examples

### Prepare a paid plans payment
Starts the Pricing Plans payment flow for a join application

```javascript
import { joinApplications } from "@wix/online-programs";

async function preparePayment() {
  const response = await joinApplications.preparePayment(
    "6d8c2f30-69f6-4484-a836-6d70a6e3f902",
    "PAID_PLANS",
  );
}

/* Promise resolves to:
 * {
 *   "joinApplication": {
 *     "_id": "6d8c2f30-69f6-4484-a836-6d70a6e3f902",
 *     "revision": "2",
 *     "_createdDate": "2026-06-01T14:26:18.245Z",
 *     "_updatedDate": "2026-06-01T14:26:42.611Z",
 *     "memberId": "6c7c7b22-67a2-43c7-9d27-3b8ed07d9a45",
 *     "programId": "8d3f2b9f-2c31-4f45-8e5a-1f4b9259a6c2",
 *     "status": "APPROVED",
 *     "paymentStatus": "PAYMENT_IN_PROGRESS",
 *     "paymentInfo": {
 *       "paidPlanIds": ["c9f1a0d7-4a5c-4f2e-9f0b-2c7a3e6d1b48"]
 *     }
 *   }
 * }
 */

```

### Prepare a single payment
Creates a Wix Payments order so the member can pay a one-time program fee

```javascript
import { joinApplications } from "@wix/online-programs";

async function preparePayment() {
  const response = await joinApplications.preparePayment(
    "4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4",
    "SINGLE_PAYMENT",
  );
}

/* Promise resolves to:
 * {
 *   "joinApplication": {
 *     "_id": "4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4",
 *     "revision": "2",
 *     "_createdDate": "2026-06-01T14:21:15.691Z",
 *     "_updatedDate": "2026-06-01T14:21:53.092Z",
 *     "memberId": "2a01d8c7-54e5-4f42-9c9f-7a5d4d2ec4f1",
 *     "programId": "8d3f2b9f-2c31-4f45-8e5a-1f4b9259a6c2",
 *     "status": "APPROVED",
 *     "paymentStatus": "PAYMENT_IN_PROGRESS",
 *     "paymentInfo": {
 *       "paymentOrderId": "0f0c80c2-cf4c-49db-93b4-30d0409aeb2b",
 *       "paidPlanIds": []
 *     }
 *   }
 * }
 */

```

### preparePayment (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { joinApplications } from '@wix/online-programs';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { joinApplications },
  // Include the auth strategy and host as relevant
});


async function preparePayment(joinApplicationId,paymentType) {
  const response = await myWixClient.joinApplications.preparePayment(joinApplicationId,paymentType);
};
```

---