Integrating Nalpeiron

Last modified October 3, 2018

This article applies to Contextual Commerce. (Looking for Classic Commerce documentation?)

The Nalpeiron Licensing & Analytics Service offers both online and offline activation, usage analytics, analytics on trial conversions, sales cycles, and more. You can easily sign up for a free trial for Nalpeiron and integrate their service with FastSpring in just a few short minutes.

Dashboard Setup

In the Dashboard for your FastSpring Store, there is one configuration needed to set up Nalpeiron with FastSpring:  a license fulfillment action, which will issue a license on a non-subscription product.

  1. From the Dashboard, select the Products menu.

    The Products menu

  2. Click the Products, Bundles, or Subscriptions tab, depending on the product for which you want to set up Nalpeiron integration.

    The Products tab

    Note about bundles

    Bundles can have a fulfillment action such as a license generator attached to the bundle itself, but if the products that make up the bundle (i.e., the bundle children) have their own fulfillments, you might want to avoid setting up a fulfillment action on the bundle itself to avoid duplicate generation (e.g. having the license key appear twice on the completion page).
  3. Click the card of the product, bundle or subscription for which you want to set up Nalpeiron integration, to open the product's details.
  4. In the product details, click ADD FULFILLMENT.

    The ADD FULFILLMENT command in a product's details

  5. In the Add Fulfillment Action dialog, select Generate a License.

    Example of the Add Fulfillment Action dialog with the Generate a License option highlighted

  6. In the resulting drop-down list, select Script (PHP or JavaScript).

    Example of the options available when you click Choose a Generator

  7. Click NEXT at the lower right-hand corner of the page.
  8. Select the desired options for the Output Format and License Name, and ensure that the Script Type is set to JavaScript. Then, click CREATE.

    Example of the General configuration tab for the Script (PHP or JavaScript) license generator

  9. In the Script Source Code (JS) field, replace the existing placeholder content with the following script:

    Example of Nalpeiron integration script
    var auth = "<auth><username>YOUR NALPEIRON USERNAME</username><password>YOUR NALPEIRON PASSWORD</password><customerid>YOUR NALPEIRON CUSTOMER ID</customerid></auth>";
    
    var data = "<data><productid>NALPEIRON PRODUCT ID</productid><amount>" + quantity + "</amount><profilename>NALPEIRON LICENSE PROFILE</profilename></data>"
    
    var response = httpPost("https://my.nalpeiron.com/shaferws.asmx/GetNextLicenseCode", {
        "Auth": auth,
        "Data": data
    });
    var xml = response.body;
    var licenses = xml.match(">(.*)<")[0];
    licenses = licenses.substring(1, licenses.length - 1);
    licenses = licenses.split(",");
    var output = "";
    for (var i = 0; i < licenses.length; i++) {
        license = output + licenses[i] + "\n";
    }
    license;
  10. Edit the script to replace the following placeholders with the information from your Nalpeiron account:
    • YOUR NALPEIRON USERNAME
    • YOUR NALPEIRON PASSWORD
    • YOUR NALPEIRON CUSTOMER ID
    • NALPEIRON PRODUCT ID
    • NALPEIRON LICENSE PROFILE

  11. Click SAVE near the top right-hand corner of the page.


For Further Assistance


If you need assistance integrating Nalpeiron with FastSpring, please open a support ticket. You can also contact Nalpeiron support.