Setting the file. One moment.
Subchapter 2.77
references/service-plugin/PAYMENT-SETTINGS.mdMarkdown3 KBView on GitHub
The Payment Settings SPI lets you integrate custom payment settings with the Wix eCommerce payment process. It’s called during payment processing (e.g., when a customer enters credit card details) and returns settings that Wix passes to the payment provider. A common use case is enforcing 3D Secure (3DS) for certain transactions. Implement the getPaymentSettings handler.
Before implementing, call ReadFullDocsMethodSchema on the docs URL to get the full request/response types.
This example enforces 3D Secure authentication for orders above a certain threshold.
import { paymentSettings } from '@wix/ecom/service-plugins';
// Configuration
const HIGH_VALUE_THRESHOLD = 1000;
paymentSettings.provideHandlers({
getPaymentSettings: async ({ request, metadata }) => {
try {
// Get the order total
const orderTotal = Number(request.order?.priceSummary?.total?.amount) || 0;
// Determine if 3DS is required based on order value
const require3DS = orderTotal >= HIGH_VALUE_THRESHOLD;
return {
paymentSettings: {
requires3dSecure: require3DS
}
};
} catch (error) {
// Default to not requiring 3DS on error
return {
paymentSettings: {
requires3dSecure: false
}
};
}
},
getPaymentSettingsForCheckout: async () => ({ blockedPaymentOptions: [] }),
});This example requires 3D Secure for specific countries or regions.
import { paymentSettings } from '@wix/ecom/service-plugins';
// Countries that require 3DS
const REQUIRE_3DS_COUNTRIES = ['GB', 'FR', 'DE', 'IT', 'ES'];
paymentSettings.provideHandlers({
getPaymentSettings: async ({ request, metadata }) => {
try {
// Get billing country from order
const billingCountry = request.order?.billingInfo?.address?.country;
// Check if country requires 3DS
const require3DS = billingCountry
? REQUIRE_3DS_COUNTRIES.includes(billingCountry)
: false;
return {
paymentSettings: {
requires3dSecure: require3DS
}
};
} catch (error) {
// Default to not requiring 3DS on error
return {
paymentSettings: {
requires3dSecure: false
}
};
}
},
getPaymentSettingsForCheckout: async () => ({ blockedPaymentOptions: [] }),
});fallbackValueForRequires3dSecure builder field to set a default value if the SPI call fails (defaults to false)