connectAccount( )
Retrieves information for connecting a new payment provider account.
Description
This function is called by Wix Payments when you try to connect a custom payment provider from your site's dashboard. When neccessary, the code implemented in this function creates a new account on the payment provider's side. The function returns the payment provider account information, or error information if account creation fails. Wix uses the return values from this function when connecting the payment provider to the site.
Note: This function has a second parameter called
context
. This parameter is for internal Wix use only. You don't need to use it in your code.
Syntax
function connectAccount(options: ConnectAccountOptions): Promise<ConnectAccountResponse>
connectAccount Parameters
NAME
TYPE
DESCRIPTION
Information to use when connecting a new payment provider account.
Returns
Fulfilled - Information about the created account.
Return Type:
NAME
TYPE
DESCRIPTION
Account credentials for making API requests to the payment provider. These
credentials are passed to the createTransaction()
and refundTransaction()
functions
to use when sending requests to the provider's API.
Payment provider account name.
Error code supplied by the payment provider if account creation fails.
Error message supplied by the payment provider if account creation fails.
Was this helpful?
1// Place this code in the <my-extension-name>.js file2// in the 'payment-provider' folder of the3// Custom Extensions section on your site.45export const connectAccount = async (options) => {6 //Logic for creating a new payment provider account, if needed.7 return {8 "credentials": {9 "client_id": "1k2k55k3k2llsssl23l45k6",10 "client_secret": "19x92ujd0-183ec-asddfasdfasd44ger-234"11 },12 "accountId": "9123467-a3e5-d4556-ff466742-234dd32dfq3456",13 "accountName": "jane.brown@example.com"14 }15};
1// Place this code in the <my-extension-name>.js file2// in the 'payment-provider' folder of the3// Custom Extensions section on your site.45export const connectAccount = async (options) => {6 //Logic for creating a new payment provider account, if needed.7 return {8 "credentials": {9 "client_id": "1k2k55k3k2llsssl23l45k6",10 "client_secret": "19x92ujd0-183ec-asddfasdfasd44ger-234",11 "price_includes_tax": "true",12 "tax_rate": "20"13 },14 "accountId": "9123467-a3e5-d4556-ff466742-234dd32dfq3456",15 "accountName": "jane.brown@example.com"16 }17};
1// Place this code in the <my-extension-name>.js file2// in the 'payment-provider' folder of the3// Custom Extensions section on your site.45export const connectAccount = async (options) => {6 //Logic for creating a new payment provider account, if needed.7 return {8 'reasonCode': 2009,9 'errorCode': 'CURRENCY_IS_NOT_SUPPORTED',10 'errorMessage': 'Currency USD is not supported'11 }12};