Limiting payment methods to specific user roles. - Ecommerce - Ecommerce - Progress Community

Limiting payment methods to specific user roles.


Limiting payment methods to specific user roles.

  • Limiting payment methods to specific user roles.
  • Hi, is there a way to limit a user's choice of payment methods in checkout based on their user role?

  • Hi,

    You could achieve the desired functionality by replacing the EcommercePaymentMethodService. This service implements an interface IEcommercePaymentMethodService and it has one very important method GetApplicablePaymentMethods(CheckoutState checkoutState, CartOrder cartOrder). This method returns which are the payment methods for a particular client. In this method you could add a filter by role. After you extend it you need to override our default implementation by adding the following code in Global.asax file in your project:

    private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
                if (e.CommandName == "Bootstrapped")
                    // Register the new Type of the IEcommercePaymentMethodService
                    <IEcommercePaymentMethodService, CustomBensEcommercePaymentMethodService>(new ContainerControlledLifetimeManager(), new InjectionConstructor());

    To summarize you need to do is create a new class extending our and override GetApplicablePaymentMethods method and add replace the default IEcommercePaymentMethodService using the information above so the system could use the extended method.

    Stefani Tacheva
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  • That worked quite well thank you.