Introduction

The Payment Settings service plugin (formerly SPI) allows you to apply custom payment settings during the payment process of an order.

Currently, the only payment setting available to customize is whether to apply 3DS to an order. If 3DS is required, the customer will have to pass an additional layer of security before completing their payment. For example:

3DS popup

Learn more:

Before you begin

It's important to note the following points before starting to code:

To add a service plugin

  1. Add the plugin to your site.
  2. Update the getConfig() function in the -config.js file that is added to your site during step 1.
  3. Update the getPaymentSettings() function in the .js file that is added to your site during step 1.

Terminology

  • 3 Domain Security (3DS): An additional layer of security for online credit and debit card transactions. The name refers to the three domains which interact using the protocol: the card issuer, the acquiring bank, and the payment gateway that facilitates the transaction. Learn more about 3DS payments with third-party payment providers.
  • Payment Providers: Different payment methods available to your Wix site. Learn more about accepting payments.
Did this help?

getConfig( )


Retrieves the configuration of your payment settings plugin.

Set your payment settings configuration in the return of the getConfig() function. Wix calls this function when you publish your site. Changes to the configuration don't take effect until you publish your site.

The only default currently available is to set a fallback value for whether to require 3 domain security to an order payment if the getPaymentSettings() function fails.

Where to find getConfig()

When you add the Payment Settings service plugin, a folder is automatically added to your site. Use the -config.js file in the folder to set the default configuration for your implementation of the service plugin.

For more information on setting your configuration, see Tutorial: Payment Settings Service Plugin.

Method Declaration
Copy
function getConfig(): Promise<PaymentSettingsConfigResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<PaymentSettingsConfigResponse>
Example of a configuration file
JavaScript
// Place this code in the <my-extension-name>-config.js file // in the 'ecom-payment-settings' folder of the // Custom Extensions section on your site. export function getConfig() { return { fallbackValueForRequires3dSecure: true, }; }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getPaymentSettings( )


Retrieves the payment settings to apply to an order based on your custom logic. Wix passes these settings to the payment provider.

Add the custom logic to apply to an order in the return of the getPaymentSettings() function. Wix calls this function when an order is placed from the checkout page of your site.

Currently, the only payment setting available to customize is whether to apply 3 domain security (3DS) to an order. Note that if the code fails then requires3dSecure sets to the value for fallbackValueForRequires3dSecure set in getConfig().

Where to find getPaymentSettings()

When you add the Payment Settings service plugin, a folder is automatically added to your site. Use the .js file in the folder to write the code to determine which payment settings to apply to an order.

For more information on customizing your payment settings, see Tutorial: Payment Settings Service Plugin.

Method Declaration
Copy
function getPaymentSettings(
  options: Options,
  context: Context,
): Promise<PaymentSettingsResponse>;
Method Parameters
optionsOptionsRequired

The order information.


contextContextRequired

Metadata about the request.

Returns
Return Type:Promise<PaymentSettingsResponse>
JavaScript
export const getPaymentSettings = (options) => { return { paymentSettings: { requires3dSecure: true, }, }; };
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?