Skip to content

Inkdit/inkdit.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

inkdit.php

This is a PHP library for interacting with Inkdit. Right now it focusses on using hosted signing pages.

Hosted Signing Page

When the user does something that requires a contract to be signed, you construct a URL that contains the information you want to pass through to the contract.

$offer_url   = '...'; // obtained from your contract page
$private_key = '...'; // obtained from your contract page

$url = inkdit_offer_url($offer_url,
  $private_key,
  array('email' => '[email protected]', 'redirect' => 'http://example.org/'),
  array('contract-input-1' => 'St. Louis'));

The user gets sent to $url. They sign the contract. Inkdit redirects them to the URL given as the 'redirect' parameter, and appends a query string.

$query_string = $_SERVER['QUERY_STRING'];
$result = inkdit_verify_signing($query_string, $private_key);

// if the signing could not be validated, $result will be false.
//
// if the signing was validated, $result will be an array containing:
//   contract_id:  the id of the newly created contract
//   contract_url: the URL of the newly created contract
//   signed_at:    the date and time that the contract was signed.

// ensure that the signing was created recently (PHP 5.3+)
$t = DateTime::createFromFormat(DateTime::ISO8601, $result['signed_at']);
if((time() - $t->getTimestamp()) > 300)
  throw new Exception('This signing was created more than 5 minutes ago!');

At this point, the signing has been validated, you know that the contract has been signed, and the user can continue with your workflow.

About

A PHP library for interacting with Inkdit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages