KR.userPaymentMethodsOrder()
Description
This function allows you to manage the display order of the payment methods available in the shop.
Prerequisite: availability of the payment method
Pour gérer l'ordre d'affichage, vérifiez la disponibilité du moyen de paiement (en fonction de la devise, du montant minimum ou maximum, des contraintes techniques...) :
- If it is on the list of compatible payment methods (see List of compatible payment methods ).
- If its contract is associated with th shop via the
Merchant Back Office . - It is present in the
paymentMethods
field, optional field (seeSelect payment methods).
If you use a payment method that is not available, a warning message appears in the browser console.
Display rules
By default, the order is defined in the
Payment by cards
If payment by card is available, it always appears first.
Example
- Payment by card is absent from the function.
// function
smartForm.userPaymentMethodsOrder = ['PAYPAL', 'APPLE_PAY']
// result
Result = ['CARDS', 'PAYPAL', 'APPLE_PAY']
- Payment by card is not first on the list.
// function
smartForm.userPaymentMethodsOrder = ['PAYPAL', 'APPLE_PAY']
// result
Result = ['CARDS', 'PAYPAL', 'APPLE_PAY']
Other payment methods
If the other payment methods are available and not listed in the function, they are displayed last.
Example
- For Apple Pay
// your shop
SHOP = ['CARDS', 'PAYPAL', 'APPLE_PAY']
// function without APPLE_PAY
smartForm.userPaymentMethodsOrder = ['CARDS', 'PAYPAL']
// result
Result = ['CARDS', 'PAYPAL', 'APPLE_PAY']
- For PayPal
// your shop
SHOP = ['CARDS', 'PAYPAL', 'APPLE_PAY' ]
// function without APPLE_PAY
smartForm.userPaymentMethodsOrder = ['CARDS', 'APPLE_PAY']
// result
Result = ['CARDS', 'APPLE_PAY', 'PAYPAL']
Example of integration
KR.setFormConfig({
smartForm:
{ userPaymentMethodsOrder: ['PAYPAL', 'APPLE_PAY', 'CARDS'] }
}
);