Collapse Menu
FastSpring App
Contact Support

Populating Transaction Data via URL Parameters

If you use the Store Builder Library (SBL) on your website, you can optionally populate certain pieces of transaction data via URL parameters. 

Parameters are values passed as part of the URL that customers use to access the store page. By adding JavaScript code to parse the URL and apply the parameter values to SBL functions, you can pass transaction data right in the URL. This approach is possible for any transaction data that can be applied via SBL functions, including:

  • Products
  • Customer First Name
  • Customer Last Name
  • Coupon Code

Here is an example that you could implement near the bottom of your page, just after the closing </body> tag.


The following example is provided "as is" and is intended for illustration purposes. You may need to adjust the code provided in the example to meet your needs or work with your specific implementation.
Example of populating transaction data via URL parameters
    var QueryString = function () {
  // This function is anonymous, is executed immediately and 
  // the return value is assigned to QueryString!
  var query_string = {};
  var query =;
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
        // If first entry with this name
    if (typeof query_string[pair[0]] === "undefined") {
      query_string[pair[0]] = decodeURIComponent(pair[1]);
        // If second entry with this name
    } else if (typeof query_string[pair[0]] === "string") {
      var arr = [ query_string[pair[0]],decodeURIComponent(pair[1]) ];
      query_string[pair[0]] = arr;
        // If third or later entry with this name
    } else {
  return query_string;
        $( document ).ready(function() {

			var s = {};
            if(QueryString.product) {
                s = {
                    'products' : [
            if( && QueryString.fname && QueryString.lname) {
				s.paymentContact = {}; =;
				s.paymentContact.firstName = QueryString.fname;
				s.paymentContact.lastName = QueryString.lname;
            if( { =;
			if (s) fastspring.builder.push(s);

The above example allows you to use URL parameters to pass information to be added to the cart session. If you specify the product in the URL, be sure to use the product path/product ID rather than the product's Display name.

For example: 

Example URL

In this example, the store page on your website would have a URL ending in cart.html. The name of the page can be whatever you need. The above adds product ID 8675309 to the cart, applies coupon FALLSALE, and applies the customer's first name, last name, and email address to the order.

If you only want to pass the product:

Example URL

If you only want to pass the product and the coupon code:

Example URL

If you pass in the customer name or email address, then currently, the first name, last name, and email address must all be passed for any of them to work. For example:

Example URL