When you're loading dynamic information to populate into a contract, it can be frustrating when the information isn't loading properly! Here are some things that may be going wrong if your tokens aren't loading inside of your contracts...

1. Not setting "dynamic" to "true" in your code

When trying to pass in dynamic variables, you need to tell the PactSafe library that you're dynamically loading the contract. This parameter will instruct PactSafe to ingest "render data" that you pass and inject it into the contract where necessary.

<script>
  (function(w,d,s,c,n,a,b){w['PactSafeObject']=n;w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)}, w[n].on=function(){(w[n].e=w[n].e||[]).push(arguments)},w[n].once=function(){(w[n].eo=w[n].eo||[]).push(arguments)},w[n].off=function(){(w[n].o=w[n].o||[]).push(arguments)},w[n].t=1*new Date(); a=d.createElement(s),b=d.getElementsByTagName(s)[0];a.async=1;a.src=c;b.parentNode.insertBefore(a,b) })(window,document,'script','//vault.pactsafe.io/ps.min.js','_ps');
  // note dynamic being set to true!
  _ps('create', '25b2b173-632a-4227-9877-31d2109d8c98', { dynamic: true });
...
</script>

2. Not passing in render_data to populate tokens

In order for dynamic information to render in your contracts, you must pass the right dynamic values based on what contract fields (tokens) are included in the JavaScript object you're loading into the page. Here's an example demonstrating how you pass render data into your contract:

var what_to_render = {
    price: "$6,000",
    total: "$6,000",
    start_date: "July 1, 2016",
    payment_terms: "Net 30",
    users: 2,
    specific_terms: "We can use your company name and logo as we see fit.",
    in_california: true,
    additional_terms: [
      {
        term: "Term 1!"
      },
      {
        term: "Term 2!"
      },
      {
        term: "Term specific to Anil"
      }
    ]
  };
  var agreement_key = 'dynamic-contract';
  _ps('load', agreement_key, { render_data: what_to_render });

You'll notice "additional_terms" is passed in as an object. PactSafe does support looping in a contract via Handlebars... just paste this into a contract to see it in action:

Contract example text...
{{#each additional_terms}}
{{this.term}}
{{/each}}


3. There are spaces in your token names

Our editor shouldn't be letting you add spaces to your token names, but it happens! If you have a space in your token name (like {{First Name}}), that will prevent all dynamic functionality from working on your web page.


None of those issues causing you heartache? Submit a ticket with us and we'll have a look!