PactSafe

The PactSafe Developer Hub

Welcome to the PactSafe developer hub. You'll find comprehensive guides and documentation to help you start working with PactSafe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Guides

Virtual Groups (and how to use them)

Virtual Groups in PactSafe are a powerful way to integrate PactSafe into your site and to—not only dynamically render information inside a contract—dynamically configure clickwrap presentation, filtering of contracts to show your Signer, and more.

Please note: Loading a group of Contracts in this manner will affect load times on the page and is not subject to normal PactSafe SLAs. If you'd like to optimize how your Contracts are loaded on the page, check out how using Groups works.

Here are some use cases where this can be used:

  • Dynamically rendering an Order Form based on the product being purchased
  • Changing the contract presented on checkout based on the products in the cart
  • Loading in contracts that need to be accepted based upon Contract Tags
  • You have a Group already but want to change what Contracts are presented for acceptance

Covered in this Guide

  • How to present multiple Contracts for acceptance in various forms
  • How to render Contracts as a clickwrap on your page with or without creating a Group in PactSafe's UI
  • Optional parameters that define how a Virtual Contract Group is configured

Sample code used in this Guide

Sample code referenced in this article is available at this Gist.

What you need for this Guide

  • Working knowledge of the JavaScript library
  • Published Contract(s)
  • Knowledge of our REST API

Getting started: Loading Contracts onto your page

When loading Contracts on your page, you'll need two things:

  1. A Published Contract
  2. A "style" in which your Contract should be presented to your user. See more on styles here.

Note: If render data is being passed in to the Virtual Group, the Style for the Group must be set to Scroll or Full so that the render data is stored as part of the record. Checkbox and Combined styles are not supported.

To load a published Contract onto your page, you can use the same _ps('load') method you would use with your traditional JavaScript library:

<!-- JavaScript goes before </head> -->
<script>
// JAVASCRIPT SNIPPET
_ps('create', '<SITE ACCESS ID>');

_ps('load', {
  // ID can be found in the URL for your Contract's properties page
  // e.g. https://app.pactsafe.com/contracts/12345
  filter: "id==12345 and tags==tag1,tag2",
  // STYLE OPTIONS: full, scroll, checkbox, combined, embedded
  style: "scroll",
  display_all: true,
  acceptance_language: "I do declare that {{contracts}} are enforceable",
  container_selector: "contracts",
  signer_id_selector: "email-address"
});
</script>
<!-- Page HTML -->
<!-- ... -->
<div id="contracts"></div>
<input id="email-address" type="email" name="email_address" />

This should render a Contract on your page if you got the ID correctly or referenced the proper case-sensitive Contract tags:

You can also reference an existing Group and augment specific parameters to customize the rendering of a Group of Contracts on your page. So if you have a group with a Group key of 'example-clickwrap', you can overwrite parameters of that Group.

Virtual Groups (and how to use them)


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.