> 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

# ConnectAccount

# Package: paymentServiceProviderServicePlugin

# Namespace: ProviderAccountsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/payments/payment-service-provider-service-plugin/accounts/connect-account.md

## Introduction

This endpoint is used to connect a merchant's Payment Service Provider (PSP) account to a Wix site.

Wix calls this endpoint when a merchant chooses to connect a PSP in the Wix dashboard.
The PSP must verify the merchant's credentials and ensure that the merchant has an operational PSP account.
Learn more about [implementing this endpoint](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/connecting-accounts.md).

---

## REST API

### Schema

```
 Method: connectAccount
 Description: This endpoint is used to connect a merchant's Payment Service Provider (PSP) account to a Wix site.  Wix calls this endpoint when a merchant chooses to connect a PSP in the Wix dashboard. The PSP must verify the merchant's credentials and ensure that the merchant has an operational PSP account. Learn more about [implementing this endpoint](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/connecting-accounts.md).
 URL: null
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  credentials, wixMerchantId
 Method parameters: 
   param name: country | type: country | description: Country where the merchant provides their services, in [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.  | validation: format COUNTRY
   param name: credentials | type: credentials | description: Merchant credentials for a PSP account. The PSP specifies the keys for this object in the [app dashboard](https://dev.wix.com/apps). The merchant is prompted to enter these credentials when they connect their PSP account to their Wix site. | required: true | validation: format map
        - name: key | type: string | description: none  
        - name: value | type: string | description: none  
   param name: currency | type: currency | description: Code for the merchant's preferred [currency](https://en.wikipedia.org/wiki/ISO_4217).  | validation: format CURRENCY
   param name: mode | type: Mode    
      - enum:
           undefined - Undefined mode.
           live - Request is live.
           sandbox - Request is for testing purposes.
   param name: siteId | type: siteId | description: Wix site GUID.  | validation: format GUID
   param name: wixMerchantId | type: wixMerchantId | description: Wix merchant GUID. | required: true 
 Return type: ConnectAccountResponse
  - name: credentials | type: object | description: Merchant credentials that Wix will use when sending the merchant's payment and refund requests.  | validation: format map
  - name: accountId | type: string | description: Merchant account GUID. The PSP must not change this value over the lifetime of the merchant's account.  
  - name: accountName | type: string | description: Merchant account name.  
  - name: reasonCode | type: integer | description: Wix [reason code](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/reason-codes.md#account-connection-failure) indicating a type of failed request.  | validation: format int32
  - name: errorCode | type: string | description: PSP-specific error code.  
  - name: errorMessage | type: string | description: PSP-specific error message.  


```

### Examples

### Responding to a failed connection attempt
```curl
curl -X POST https://psp.example.com/connect \
 -H 'Content-Type: application/json' \
 -H 'Digest: JWT=ai0zIQqt71bmnkgEJ1CRJchjKJup' \
 -d '{
  "credentials": {
    "client_id": "MerchantClientId",
    "client_secret": "MerchantClientSecret"
  },
  "country": "US",
  "currency": "USD",
  "mode": "live",
  "wixMerchantId": "000000-0000-0000-0000-000000000000"
}'
```

### Adding credentials to the response
```curl
curl -X POST https://psp.example.com/connect \
 -H 'Content-Type: application/json' \
 -H 'Digest: JWT=ai0zIQqt71bmnkgEJ1CRJchjKJup' \
 -d '{
  "credentials": {
    "client_id": "MerchantClientId",
    "client_secret": "MerchantClientSecret"
  },
  "country": "US",
  "currency": "USD",
  "mode": "live",
  "wixMerchantId": "000000-0000-0000-0000-000000000000"
}'
```

### Using numeric and boolean credentials
```curl
curl -X POST https://psp.example.com/connect \
 -H 'Content-Type: application/json' \
 -H 'Digest: JWT=ai0zIQqt71bmnkgEJ1CRJchjKJup' \
 -d '{
  "credentials": {
    "client_id": "MerchantClientId",
    "client_secret": "MerchantClientSecret",
    "price_includes_tax": "true",
    "tax_percentage": "20"
  },
  "country": "US",
  "currency": "USD",
  "mode": "live",
  "wixMerchantId": "000000-0000-0000-0000-000000000000"
}'
```

### Connecting an account
```curl
curl -X POST https://psp.example.com/connect \
 -H 'Content-Type: application/json' \
 -H 'Digest: JWT=ai0zIQqt71bmnkgEJ1CRJchjKJup' \
 -d '{
  "credentials": {
    "client_id": "MerchantClientId",
    "client_secret": "MerchantClientSecret"
  },
  "country": "US",
  "currency": "USD",
  "mode": "live",
  "wixMerchantId": "000000-0000-0000-0000-000000000000"
}'
```

---