Search.../

getPaymentSettings( )

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

Description

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 custom extension, a folder is automatically added to your site. Use the <my-extension-name>.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 Custom Extension.

Syntax

function getPaymentSettings(options: Options): Promise<PaymentSettingsResponse>

getPaymentSettings Parameters

NAME
TYPE
DESCRIPTION
options
Options

The order information.

Returns

Fulfilled - Retrieved payment settings.

Return Type:

Promise<PaymentSettingsResponse>
NAME
TYPE
DESCRIPTION
paymentSettings
PaymentSettings

Retrieved payment settings.

Was this helpful?

Example of a paymentSettings return value

Copy Code
1export const getPaymentSettings = (options) => {
2
3 return {
4 "paymentSettings": {
5 "requires3dSecure": true
6 }
7 };
8};
Require 3DS if the order is greater than $50

Copy Code
1export const getPaymentSettings = async (options) => {
2 return {
3 paymentSettings: {
4 // Extract the subtotal price from the order, convert it to a number
5 // and check if the price is equal or greater than $50.
6 requires3dSecure: parseFloat(options.order.priceSummary.subtotal.amount) >= 50
7 }
8 };
9};
10
11/* If the subtotal price is less than 50, the following payment settings are returned:
12 *
13 * {
14 * "paymentSettings": {
15 * "requires3dSecure": "false"
16 * }
17 * }
18 */