> 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

# RemoveCoupon

# Package: onlinePrograms

# Namespace: JoinApplicationsService

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

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

## Introduction

Removes an applied coupon from a join application's payment order.

The join application must have a prepared payment order with a coupon applied, and `paymentStatus` must be `PAYMENT_IN_PROGRESS`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. The last two let a member clear a coupon when retrying after a failed or canceled payment.

Returns the order total after the coupon is removed.

To apply a coupon, call [Apply Coupon](https://dev.wix.com/docs/api-reference/business-management/online-programs/join-applications/apply-coupon.md).

---

## REST API

### Schema

```
 Method: removeCoupon
 Description: Removes an applied coupon from a join application's payment order.  The join application must have a prepared payment order with a coupon applied, and `paymentStatus` must be `PAYMENT_IN_PROGRESS`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. The last two let a member clear a coupon when retrying after a failed or canceled payment.  Returns the order total after the coupon is removed.  To apply a coupon, 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}/remove-coupon
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  couponId
 Method parameters: 
   param name: couponId | type: couponId | description: GUID of the coupon to remove. Must match the coupon applied to the order. | required: true | validation: format GUID
 Return type: RemoveCouponResponse
  - name: total | type: string | description: Order total after the coupon is removed, formatted using the precision of the site currency configured in Site Properties. The value doesn't include the currency.  | validation: maxLength 50

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: INVALID_PAYMENT_STATUS | Description: The join application's `paymentStatus` doesn't permit removing a coupon. Allowed from `PAYMENT_IN_PROGRESS`, `PAYMENT_FAILED`, and `PAYMENT_CANCELED`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: COUPON_DOES_NOT_EXIST | Description: The specified coupon isn't applied to the payment order.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_PAYMENT_ORDER | Description: No payment order exists for the join application. Call Prepare Payment first.


```

### Examples

### Remove coupon from join application
Removes a previously applied coupon from the payment order

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/participants/v3/join-applications/4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4/remove-coupon' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "couponId": "748c7a79-7b13-4b0d-9c25-e1d090bd11f6"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.joinApplications.removeCoupon(joinApplicationId, couponId)
 Description: Removes an applied coupon from a join application's payment order.  The join application must have a prepared payment order with a coupon applied, and `paymentStatus` must be `PAYMENT_IN_PROGRESS`, `PAYMENT_FAILED`, or `PAYMENT_CANCELED`. The last two let a member clear a coupon when retrying after a failed or canceled payment.  Returns the order total after the coupon is removed.  To apply a coupon, 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, couponId
 Method parameters: 
   param name: couponId | type: string | description: GUID of the coupon to remove. Must match the coupon applied to the order. | required: true | validation: format GUID
   param name: joinApplicationId | type: string | description: GUID of the join application to remove the coupon from. | required: true | validation: format GUID
 Return type: PROMISE<RemoveCouponResponse>
  - name: total | type: string | description: Order total after the coupon is removed, formatted using the precision of the site currency configured in Site Properties. The value doesn't include the currency.  | validation: maxLength 50

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: INVALID_PAYMENT_STATUS | Description: The join application's `paymentStatus` doesn't permit removing a coupon. Allowed from `PAYMENT_IN_PROGRESS`, `PAYMENT_FAILED`, and `PAYMENT_CANCELED`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: COUPON_DOES_NOT_EXIST | Description: The specified coupon isn't applied to the payment order.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_PAYMENT_ORDER | Description: No payment order exists for the join application. Call Prepare Payment first.


```

### Examples

### Remove a coupon from a join application
Removes an applied coupon from the payment order

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

async function removeCoupon() {
  const response = await joinApplications.removeCoupon(
    "4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4",
    "748c7a79-7b13-4b0d-9c25-e1d090bd11f6",
  );
}

/* Promise resolves to:
 * {
 *   "total": "25.00"
 * }
 */

```

### removeCoupon (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 removeCoupon(joinApplicationId,couponId) {
  const response = await myWixClient.joinApplications.removeCoupon(joinApplicationId,couponId);
};
```

---