Select version
v7.7 v7.6 v7.5 v7.3 v7.1 v7.0 v6.8 v6.7 v6.6 v6 v5 v4 v3 v2

Move Payment Method Config from XML to UI

Payment method configuration moved from standard .NET config files like PayPal.config into the backend UI to make configuration easier and more accessible. Furthermore it enables uCommerce to support multiple instances of each payment method, e.g. PayPal US, PayPal EU, each with their own unique configuration.

To accommodate the new capabilities the configuration must be moved from the XML config file to the payment method itself in the backend.

Finding the Payment Method Configuration Files.

Each payment method has a configuration file associated, which is located in the file system:

  • For Umbraco: '\Umbraco\uCommerce\Configuration\Payments' (relative to the application root)
  • For Sitecore: '\sitecore modules\Shell\uCommerce\Configuration\Payments' (relative to the application root)

The files use the payment method name as the file name. When you open up one of the files you'll find a single XML node with the properties you need to configure for the gateway.

image

Setting Values in the Backend

To set the properties in the backend, log in to the CMS and find the paymentmethod that uses the payment method you need. They are located under "Settings -> Orders -> Payment Methods".

image

For each of the old values there will be a field available under the "Common" tab for the payment method as long as the service are set to the right payment gateway.

image

Accessing Configuration via the API

The Old Way

Using the old approach you had a CommerceConfigurationProvider injected in your constructor so you could get the section with the configured values:

    
    
    	public MyPaymentMethodService(CommerceConfigurationProvider configProvider)
    	{
    		Section = configProvider.GetSection<PayExPaymentMethodServiceConfigurationSection>();
    	}
    
    

You could then use the section to retrieve the configuration values like so:

    
    
    	string callbackUrl = Section.CallbackUrl;
    
    

The New Way

The code is now a little simpler since you can remove the CommerceConfigurationProvider from the constructor and retrieve the values directly on the payment method like so:

    
    
    	string callBackUrl = paymentMethod.DynamicProperty<string>().CallbackUrl;
    
    
uCommerce Aps - Studsgade 29B - 8000 Aarhus C - Denmark
Phone +45 61 799 997 - Email info@ucommerce.dk uCommerce logo