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
The order information.
Returns
Fulfilled - Retrieved payment settings.
Return Type:
NAME
TYPE
DESCRIPTION
Retrieved payment settings.
Was this helpful?
paymentSettings
return value1export const getPaymentSettings = (options) => {23 return {4 "paymentSettings": {5 "requires3dSecure": true6 }7 };8};
1export const getPaymentSettings = async (options) => {2 return {3 paymentSettings: {4 // Extract the subtotal price from the order, convert it to a number5 // and check if the price is equal or greater than $50.6 requires3dSecure: parseFloat(options.order.priceSummary.subtotal.amount) >= 507 }8 };9};1011/* If the subtotal price is less than 50, the following payment settings are returned:12 *13 * {14 * "paymentSettings": {15 * "requires3dSecure": "false"16 * }17 * }18 */