Revindex Storefront

How to email external license key

Last updated on 2021-06-16 1 mins. to read

If you sell software or any product that needs to generate a license key or serial number from an external system, you can use the Place order action rule to retrieve external resources. Please see Actions for more information.

The following example shows how to create a Place order action rule that calls an external URL to retrieve the generated license key and send it to the customer by email.

<xsl:transform xmlns:xsl="" version="2.0">
  <xsl:template match="/">
    <!--  Craft our URL to retrieve the license key passing any query parameter  -->
    <xsl:variable name="url" select="concat('', /in/salesOrder/salesOrderNumber)"/>
    <!--  Expect license key in plain text. Use document() function to return complex XML instead.  -->
    <xsl:variable name="key" select="unparsed-text($url)"/>
      <!--  Send email to customer with their license key  -->
          <xsl:value-of select="/in/user/email"/>
        <subject>Your license key</subject>
            <xsl:value-of select="$key"/>


Powered by Revindex Wiki