> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# DefendDispute

# Package: disputes

# Namespace: DisputeService

# Method link: https://dev.wix.com/docs/api-reference/business-management/payments/disputes/disputes/defend-dispute.md

## Permission Scopes:
Manage Disputes: SCOPE.DC-PAYMENTS.MANAGE-DISPUTES

## Introduction

Defends a dispute by submitting evidence to the payment service provider or bank handling the dispute.

To upload evidence documents, use the [Dispute Evidence Documents API](https://dev.wix.com/docs/api-reference/business-management/payments/disputes/dispute-evidence-documents/create-dispute-evidence-document.md). This method submits all the evidence documents uploaded for the specified dispute.

---

## REST API

### Schema

```
 Method: defendDispute
 Description: Defends a dispute by submitting evidence to the payment service provider or bank handling the dispute.  To upload evidence documents, use the [Dispute Evidence Documents API](https://dev.wix.com/docs/api-reference/business-management/payments/disputes/dispute-evidence-documents/create-dispute-evidence-document.md). This method submits all the evidence documents uploaded for the specified dispute.
 URL: https://www.wixapis.com/payments/disputes/v1/disputes/{disputeId}/defend
 Method: POST
 Return type: DefendDisputeResponse
  - name: dispute | type: Dispute | description: Updated dispute after submitting evidence.  
     - name: id | type: string | description: Dispute GUID.  | validation: format GUID, immutable
     - name: chargeId | type: string | description: GUID of the charge that is being disputed.  | validation: format GUID, immutable
     - name: providerDisputeId | type: string | description: Unique identifier assigned by the payment service provider for this dispute.  | validation: minLength 1, maxLength 64, immutable
     - name: stage | type: DisputeStage | description: Stage of the dispute process.  | read-only: true 
         - enum:
         -     CHARGEBACK: Formal dispute filed through the card network or issuing bank.
         -     INQUIRY: Initial inquiry from the customer requesting information about the charge.
     - name: reason | type: DisputeReason | description: Reason why the customer initiated the dispute.  | read-only: true 
         - enum:
         -     FRAUD_CARD_PRESENT: Fraudulent use of a physical card.
         -     FRAUD_CARD_ABSENT: Fraudulent use without the physical card present.
         -     DUPLICATE_PROCESSING: Duplicate charge processing.
         -     SERVICES_NOT_PROVIDED: Services or goods were not provided as promised.
         -     CANCELED_RECURRING: Recurring payment that should have been canceled.
         -     NOT_AS_DESCRIBED: Item received was not as described.
         -     COUNTERFEIT: Item received was counterfeit.
         -     MISREPRESENTATION: Merchant misrepresented the transaction.
         -     CANCELED: Transaction was canceled but still charged.
         -     OTHER: Other dispute reason not covered by specific categories.
     - name: currencyCode | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. Matches the currency of the disputed charge.  | validation: format CURRENCY, immutable
     - name: amount | type: string | description: Disputed amount in the currency's main units. For example, `"12.95"` for $12.95.  | validation: immutable, decimalValue {"gt":"0","maxScale":8}
     - name: status | type: DisputeStatus | description: Current status of the dispute. This indicates what action is required and who needs to take it.  | read-only: true 
         - enum:
         -     WAITING_MERCHANT: Merchant action required to proceed with the dispute.
         -     UNDER_REVIEW: Dispute is being reviewed by the payment service provider or bank.
         -     WAITING_BUYER: Customer action required to proceed with the dispute.
         -     WON: Dispute resolved in favor of the merchant.
         -     LOST: Dispute resolved in favor of the customer. When a dispute is lost, the refund is processed automatically.
     - name: sellerProtection | type: SellerProtection | description: Level of seller protection coverage for this dispute.  Seller protection is set by the payment provider. For example, PayPal offers a [seller protection program](https://www.paypal.com/ua/legalhub/paypal/seller-protection).  | read-only: true 
         - enum:
         -     NOT_ELIGIBLE: Transaction is not eligible for seller protection.
         -     ELIGIBLE: Transaction is eligible for basic seller protection.
         -     EXTENDED: Transaction is eligible for extended seller protection coverage.
     - name: channel | type: DisputeChannel | description: Channel through which the dispute is being processed.  | read-only: true 
         - enum:
         -     INTERNAL: Dispute is processed by the payment service provider.
         -     EXTERNAL: Dispute is processed through the card network or issuing bank.
     - name: dueDate | type: string | description: The latest date and time until which the dispute can remain in its current status.  If this date passes, the dispute will be resolved against the party that is required to take action. For example, if the status is `WAITING_MERCHANT`, and the due date passes, the dispute will be `LOST` and a refund will be processed automatically.  | read-only: true | validation: format date-time
     - name: networkReasonCode | type: string | description: Network reason code provided by the card network or issuing bank that initiated the dispute.  | validation: minLength 1, maxLength 64
     - name: defendable | type: boolean | description: Whether the dispute can be defended with evidence.  | read-only: true 
     - name: defendedDate | type: string | description: Date and time at which the dispute was defended.  | read-only: true | validation: format date-time
     - name: acceptedDate | type: string | description: Date and time at which the dispute was accepted.  | read-only: true | validation: format date-time
     - name: actions | type: array<DisputeAction> | description: List of actions that can be performed on the dispute. Each action has a specific due date by which it must be completed. Available actions depend on the dispute's current status and stage.  | read-only: true | validation: maxItems 20
        - name: type | type: DisputeActionType | description: Type of action that can be performed.  
             - enum:
             -     ACCEPT: Dispute can be accepted.
             -     DEFEND: Dispute can be defended.
        - name: dueDate | type: string | description: Latest date and time by which this action must be performed.  | validation: format date-time
     - name: defendedBy | type: DefendedBy | description: Identifies who submitted the defence for this dispute.  Set when the dispute is defended: `MERCHANT` when the merchant submits evidence via the site-level defend flow, `WIX_AUTO` when Wix auto-defence submits on the merchant's behalf, `PROVIDER` when the payment service provider defends on the merchant's behalf.  | read-only: true 
         - enum:
         -     MERCHANT: Merchant submitted the defence manually via the site-level defend flow.
         -     WIX_AUTO: Wix auto-defence submitted the defence automatically on the merchant's behalf.
         -     PROVIDER: Payment service provider defended the dispute on the merchant's behalf.
     - name: createdDate | type: string | description: Date and time the dispute was created.  | read-only: true | validation: format date-time, immutable
     - name: updatedDate | type: string | description: Date and time the dispute was updated.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, which increments by 1 each time the dispute is updated. To prevent conflicting changes, the current revision must be passed when updating the dispute. Ignored when creating a dispute.  | read-only: true | validation: format int64
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the dispute 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 assigned to the dispute for organization and filtering purposes.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or 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 who has access to the labeled entity itself, including site members and visitors.  


```

### Examples

### Defend a dispute
Initiates the dispute defense process - evidence must be submitted separately via Dispute Evidence Document API

```curl
curl -X POST \
'https://www.wixapis.com/payments/disputes/v1/disputes/12345678-1234-1234-1234-123456789012/defend' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.payments.disputes.defendDispute(disputeId)
 Description: Defends a dispute by submitting evidence to the payment service provider or bank handling the dispute.  To upload evidence documents, use the [Dispute Evidence Documents API](https://dev.wix.com/docs/api-reference/business-management/payments/disputes/dispute-evidence-documents/create-dispute-evidence-document.md). This method submits all the evidence documents uploaded for the specified dispute.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  disputeId
 Method parameters: 
   param name: disputeId | type: string | description: GUID of the dispute to defend. | required: true | validation: format GUID
 Return type: PROMISE<DefendDisputeResponse>
  - name: dispute | type: Dispute | description: Updated dispute after submitting evidence.  
     - name: _id | type: string | description: Dispute GUID.  | validation: format GUID, immutable
     - name: chargeId | type: string | description: GUID of the charge that is being disputed.  | validation: format GUID, immutable
     - name: providerDisputeId | type: string | description: Unique identifier assigned by the payment service provider for this dispute.  | validation: minLength 1, maxLength 64, immutable
     - name: stage | type: DisputeStage | description: Stage of the dispute process.  | read-only: true 
         - enum:
         -     CHARGEBACK: Formal dispute filed through the card network or issuing bank.
         -     INQUIRY: Initial inquiry from the customer requesting information about the charge.
     - name: reason | type: DisputeReason | description: Reason why the customer initiated the dispute.  | read-only: true 
         - enum:
         -     FRAUD_CARD_PRESENT: Fraudulent use of a physical card.
         -     FRAUD_CARD_ABSENT: Fraudulent use without the physical card present.
         -     DUPLICATE_PROCESSING: Duplicate charge processing.
         -     SERVICES_NOT_PROVIDED: Services or goods were not provided as promised.
         -     CANCELED_RECURRING: Recurring payment that should have been canceled.
         -     NOT_AS_DESCRIBED: Item received was not as described.
         -     COUNTERFEIT: Item received was counterfeit.
         -     MISREPRESENTATION: Merchant misrepresented the transaction.
         -     CANCELED: Transaction was canceled but still charged.
         -     OTHER: Other dispute reason not covered by specific categories.
     - name: currencyCode | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. Matches the currency of the disputed charge.  | validation: format CURRENCY, immutable
     - name: amount | type: string | description: Disputed amount in the currency's main units. For example, `"12.95"` for $12.95.  | validation: immutable, decimalValue {"gt":"0","maxScale":8}
     - name: status | type: DisputeStatus | description: Current status of the dispute. This indicates what action is required and who needs to take it.  | read-only: true 
         - enum:
         -     WAITING_MERCHANT: Merchant action required to proceed with the dispute.
         -     UNDER_REVIEW: Dispute is being reviewed by the payment service provider or bank.
         -     WAITING_BUYER: Customer action required to proceed with the dispute.
         -     WON: Dispute resolved in favor of the merchant.
         -     LOST: Dispute resolved in favor of the customer. When a dispute is lost, the refund is processed automatically.
     - name: sellerProtection | type: SellerProtection | description: Level of seller protection coverage for this dispute.  Seller protection is set by the payment provider. For example, PayPal offers a [seller protection program](https://www.paypal.com/ua/legalhub/paypal/seller-protection).  | read-only: true 
         - enum:
         -     NOT_ELIGIBLE: Transaction is not eligible for seller protection.
         -     ELIGIBLE: Transaction is eligible for basic seller protection.
         -     EXTENDED: Transaction is eligible for extended seller protection coverage.
     - name: channel | type: DisputeChannel | description: Channel through which the dispute is being processed.  | read-only: true 
         - enum:
         -     INTERNAL: Dispute is processed by the payment service provider.
         -     EXTERNAL: Dispute is processed through the card network or issuing bank.
     - name: dueDate | type: Date | description: The latest date and time until which the dispute can remain in its current status.  If this date passes, the dispute will be resolved against the party that is required to take action. For example, if the status is `WAITING_MERCHANT`, and the due date passes, the dispute will be `LOST` and a refund will be processed automatically.  | read-only: true 
     - name: networkReasonCode | type: string | description: Network reason code provided by the card network or issuing bank that initiated the dispute.  | validation: minLength 1, maxLength 64
     - name: defendable | type: boolean | description: Whether the dispute can be defended with evidence.  | read-only: true 
     - name: defendedDate | type: Date | description: Date and time at which the dispute was defended.  | read-only: true 
     - name: acceptedDate | type: Date | description: Date and time at which the dispute was accepted.  | read-only: true 
     - name: actions | type: array<DisputeAction> | description: List of actions that can be performed on the dispute. Each action has a specific due date by which it must be completed. Available actions depend on the dispute's current status and stage.  | read-only: true | validation: maxItems 20
        - name: type | type: DisputeActionType | description: Type of action that can be performed.  
             - enum:
             -     ACCEPT: Dispute can be accepted.
             -     DEFEND: Dispute can be defended.
        - name: dueDate | type: Date | description: Latest date and time by which this action must be performed.  
     - name: defendedBy | type: DefendedBy | description: Identifies who submitted the defence for this dispute.  Set when the dispute is defended: `MERCHANT` when the merchant submits evidence via the site-level defend flow, `WIX_AUTO` when Wix auto-defence submits on the merchant's behalf, `PROVIDER` when the payment service provider defends on the merchant's behalf.  | read-only: true 
         - enum:
         -     MERCHANT: Merchant submitted the defence manually via the site-level defend flow.
         -     WIX_AUTO: Wix auto-defence submitted the defence automatically on the merchant's behalf.
         -     PROVIDER: Payment service provider defended the dispute on the merchant's behalf.
     - name: _createdDate | type: Date | description: Date and time the dispute was created.  | read-only: true | validation: immutable
     - name: _updatedDate | type: Date | description: Date and time the dispute was updated.  | read-only: true 
     - name: revision | type: string | description: Revision number, which increments by 1 each time the dispute is updated. To prevent conflicting changes, the current revision must be passed when updating the dispute. Ignored when creating a dispute.  | read-only: true | validation: format int64
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the dispute 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 assigned to the dispute for organization and filtering purposes.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or 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 who has access to the labeled entity itself, including site members and visitors.  


```

### Examples

### defendDispute
```javascript
import { disputes } from '@wix/payments';

async function defendDispute(disputeId) {
  const response = await disputes.defendDispute(disputeId);
};
```

### defendDispute (with elevated permissions)
```javascript
import { disputes } from '@wix/payments';
import { auth } from '@wix/essentials';

async function myDefendDisputeMethod(disputeId) {
  const elevatedDefendDispute = auth.elevate(disputes.defendDispute);
  const response = await elevatedDefendDispute(disputeId);
}
```

### defendDispute (self-managed)
Self-managed 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 { disputes } from '@wix/payments';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function defendDispute(disputeId) {
  const response = await myWixClient.disputes.defendDispute(disputeId);
};
```

---