When you're developing against the PactSafe platform, you'll more than likely not want to test against the production system you'll be deploying to. Makes sense! We've built our platform to support your development needs as you embed contracts into your own apps, websites, and more. Using Sites, you can configure multiple PactSafe environments that allow you to share assets as you promote your configuration through to production.

One Site per environment

Within PactSafe, you can create different "Sites" or containers to help you manage the different environments that you're testing against, which may include dev, staging, preview, and production. As part of PactSafe Professional, you can create as many Sites as you need to map to your own environment. Here's an example of a Site configuration:

Want to create more Sites? Just click "Create Site" in the upper right to add a new onw.

Managing across multiple Sites

You can navigate to each of your respective Sites to manage signers, contracts, and groups by using the Site Switcher in the upper right hand corner of your screen:

Things of note for Sites that you're managing:

  • In development, you may be interesting in using PactSafe's "Test Mode" when sending calls to our system.
  • You can set your Contracts as "Shared", which will share your Contracts across all of your Sites. That way, Contracts you're testing in Dev can immediately be available in Staging or Production.
  • Currently, Groups cannot be shared across Sites. We're working on this.

Getting started with testing using the JavaScript Library

When developing, you may want to debug the calls you're making and see when calls are sending to PactSafe. If you're using our JavaScript library, there are 2 things you'll definitely want to start out using to see 1) when PactSafe events are firing and what callback info is being passed and 2) what parameters are being passed when events are being sent to and being pulled from PactSafe.

Listen to all PactSafe events firing on your page

To start listening to all events being fired by PactSafe, you can add the following code after your snippet to start listening to events:

<script type="text/javascript">
(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');

// get your ACCESS ID at https://app.pactsafe.com/settings/account
// ACCESS ID is unique to each site
_ps('create', 'ACCESS_ID');

_ps.debug = true;
// OR

This code will start pushing all of the events that are happening in the JavaScript library to your console including callback parameters, objects, and more for when your Group is loaded on the page, when the Signer ID is set, etc. Learn more about what events you can listen to.

Track what parameters are being sent

You can use "Test Mode" to send test data to PactSafe. To enable test mode, add an additional parameter to your _ps('create') call like so:

_ps('create', 'ACCESS_ID', { test_mode: true });

You can read more about test mode and how to clear test data at our JavaScript Library Overview or our PS.js Reference Docs.