Connecting Accounts

When a merchant requests to connect their Wix site to a Payment Service Provider (PSP), Wix sends a request to the PSP's Connect Account endpoint. The PSP must verify the request and respond to Wix with any extra credentials needed for the merchant's account. This article includes general information about implementing the Connect Account endpoint as well as some sample flows.

Implement the Connect Account endpoint

Every request sent by Wix to the Connect Account endpoint includes these fields:

  • credentials: An object containing credentials provided by the merchant when they make the connection request. A PSP can configure the credentials fields that are requested in the app dashboard.
  • wixMerchantId: The merchant's Wix merchant ID. This is a unique identifier for the merchant.

Requests can also include these optional fields:

  • country: The country where the merchant is located.
  • currency: The currency used by the merchant.

After receiving a request, the PSP must take the following steps:

  • Verify the credentials provided by the merchant.
  • Ensure the merchant has an operational account with the PSP.
  • If possible, ensure the site's country and currency are appropriate for further payments.

    Note: The site's country and currency can change after the merchant connects their account. The PSP must validate the currency on each payment request.

The Connect Account endpoint's response must include the following fields:

  • accountId: A unique identifier for the merchant's account. This value must be the same if the merchant connects their account multiple times from the same site.
  • accountName: The name of the merchant's PSP account. This value is displayed partially in the Wix dashboard.
  • credentials: The credentials received in the request plus any other credentials the merchant needs to make payment and refund requests. This object is included by Wix in all Create Transaction and Refund Transaction requests. This object can only contain string values, so booleans, numbers, or dates must be represented as strings.

Wix uses reason codes to indicate the statuses of account connection requests. A PSP's Create Account endpoint should respond with the appropriate reason code for each status. For a list of reason codes, see Reason Codes.

Requests made to the Connect Account endpoint include a Digest header whose value is a JSON Web Token. The PSP should use this value to validate all requests to the endpoint. Learn more about JWT validation.

Sample flows

Here are some examples of how to implement the Connect Account endpoint. The examples are applicable for both live and sandbox modes.

Basic account connection

  1. Wix calls Connect Account with the following request body:
    Copy
  2. The PSP responds with an HTTP status code of 200 and this JSON object:
    Copy

Adding numeric and boolean credentials when connecting

  1. Wix calls Connect Account with the following request body:

    Copy
  2. The PSP responds with an HTTP status code of 200 and a JSON object that adds boolean and numeric values to the credentials object:

    Copy

Failed account connection

  1. Wix calls Connect Account with the following request body:
    Copy
  2. The PSP responds with a 200 HTTP status code and the following JSON object. The response contains a 2009 reason code, which indicates that the PSP doesn't support the site's currency. The values of the errorCode and errorMessage fields can be customized by the PSP. To find reason codes for other cases, see Reason Codes.
    Copy
Did this help?