Creating External Pricing Services

Pressero can integrate with any external pricing service that is exposed on the web. In order to explain how it works, we will create a scenario where an MIS partner wants to expose their pricing service to Pressero.


The product “Test" will need to display a pricing engine like the one shown in Figure 1. Since each product may have different set of options like stock, color, coating, etc. Pressero needs to retrieve the correct information from the MIS. For this example we will assume that the MIS Partner will use C# to create the web service that will provide the pricing information to Pressero.

The first step is to create the classes that will expose the different options and its values to the end user. Let’s call them Pricing Parameters. The code displayed below describes the pricing parameter structure. It is important to mention that each parameter may have a set of options.



  1. [Serializable]
  2. public class PricingParameter {
  3.     public string ID { get; set; }
  4.     public string Label { get; set; }
  5.     public List<PricingParameterOption> Options { get; set; }
  7.     public PricingParameter() {
  8.         this.Options = new List<PricingParameterOption>();
  9.     }
  11.     public PricingParameter(string label, string id)
  12.         : this() {
  13.         this.ID = id;
  14.         this.Label = label;
  15.     }
  17.     public void AddOptionValue(string text, string value) {
  18.         this.Options.Add(new PricingParameterOption(text, value));
  19.     }
  20. }
  22. [Serializable]
  23. public class PricingParameterOption {
  24.     public string Key { get; set; }
  25.     public string Value { get; set; }
  27.     public PricingParameterOption() {
  29.     }
  31.     public PricingParameterOption(string key, string value)
  32.         : this() {
  33.         this.Key = key; 
  34.         this.Value = value;
  35.     }
  36. }
  37.     public class PricingResult
  38.     {
  39.         public string Error { get; set; }
  40.         public decimal Price { get; set; }
  41.         public double Weight { get; set; }
  42.         public WeightUnit WeightUnit { get; set; }
  43.         public List<PricingParameterOption> { get; set; }
  44.     }

These objects will be used when Pressero asks the web service for a set of options for a certain product.

  1. [WebMethod]
  2. public List GetOptionsForProduct(string user, string accessToken, string productID) {
  4. PricingParameter colorOptions = new PricingParameter("Paper Color", "color");
  5. colorOptions.AddOptionValue("Black", "b");
  6. colorOptions.AddOptionValue("Red", "r");
  7. colorOptions.AddOptionValue("White", "w");
  8. colorOptions.AddOptionValue("Yellow", "y");
  10. PricingParameter paperOptions = new PricingParameter("Paper Type", "paper");
  11. paperOptions.AddOptionValue("Glossy", "g");
  12. paperOptions.AddOptionValue("Matte", "m");
  14. List options = new List();
  15. options.Add(colorOptions);
  16. options.Add(paperOptions);
  17. return options;
  18. }
The code above shows that Pressero can also send product and authentication information so the correct options are returned based on the product. When this information gets displayed to the end user it will fire the call for the pricing. It will then activate another method in the MIS webservice, so the price can be calculated based on the selected options for each parameter.

  1. [WebMethod]
  2. public decimal GetPriceForProduct(string user, string accessToken, string productId, int quantity, List options) {
  3. return 10 * quantity;
  4. }

By analyzing the code above, it is possible to see that Pressero also sends the quantity information as well as the options selected for each parameter. With all this information, it is possible to calculate the correct price for a certain product based on the options.

Plug-and-Play Pricing Provider Service

We also have a separate DLL that can be used by .Net developers in order to create Plug-and-Play pricing providers. By using a web service that implements the IPricingService interface, integration developers will be able to test the pricing engine at any time. Click here to download the sample project that contains the DLL.

Technical Support

Note: Aleyant is unable to provide free technical support to you for this capability. Any requests for assistance will be treated a paid professional service.

Related Documentation