Contract
Table of Contents
- $throwError : mixed
- __construct() : void
- Initialize Contract API
- createTemplate() : array<string|int, mixed>
- Create new contract template
- deleteTemplate() : array<string|int, mixed>
- Delete contract template
- generate() : array<string|int, mixed>
- Generate document using template and transaction data
- getTemplate() : array<string|int, mixed>
- Get contract template
- listTemplate() : array<string|int, mixed>
- Retrieve a list of contract templates
- throwAPIException() : void
- Whether an exception should be thrown if API response contains an error message
- updateTemplate() : array<string|int, mixed>
- Update contract template
Properties
$throwError
private
mixed
$throwError
= false
Methods
__construct()
Initialize Contract API
public
__construct() : void
Tags
Return values
void —createTemplate()
Create new contract template
public
createTemplate(string $name, string $content[, string $orientation = "0" ][, string $timezone = "UTC" ][, string $font = "Open Sans" ]) : array<string|int, mixed>
Parameters
- $name : string
-
Template name
- $content : string
-
Template HTML content
- $orientation : string = "0"
-
0=Portrait(Default) 1=Landscape
- $timezone : string = "UTC"
-
Template timezone
- $font : string = "Open Sans"
-
Template font
Tags
Return values
array<string|int, mixed> —deleteTemplate()
Delete contract template
public
deleteTemplate(string $templateId) : array<string|int, mixed>
Parameters
- $templateId : string
-
Template ID
Tags
Return values
array<string|int, mixed> —generate()
Generate document using template and transaction data
public
generate(string $templateId[, string $format = "PDF" ][, string $transactionId = "" ][, array<string|int, mixed> $fillData = array() ]) : array<string|int, mixed>
Parameters
- $templateId : string
-
Template ID
- $format : string = "PDF"
-
PDF, DOCX or HTML
- $transactionId : string = ""
-
Fill the template with data from specified transaction
- $fillData : array<string|int, mixed> = array()
-
Array data in key-value pairs to autofill dynamic fields, data from user ID will be used first in case of a conflict. For example, passing {"myparameter":"abc"} would fill %{myparameter} in contract template with "abc".
Tags
Return values
array<string|int, mixed> —getTemplate()
Get contract template
public
getTemplate(string $templateId) : array<string|int, mixed>
Parameters
- $templateId : string
-
Template ID
Tags
Return values
array<string|int, mixed> —listTemplate()
Retrieve a list of contract templates
public
listTemplate([int $order = -1 ][, int $limit = 10 ], int $offset[, string $filterTemplateId = "" ]) : array<string|int, mixed>
Parameters
- $order : int = -1
-
Sort results by newest(-1) or oldest(1)
- $limit : int = 10
-
Number of items to be returned per call
- $offset : int
-
Start the list from a particular entry index
- $filterTemplateId : string = ""
-
Filter result by template ID
Tags
Return values
array<string|int, mixed> —throwAPIException()
Whether an exception should be thrown if API response contains an error message
public
throwAPIException([bool $throwException = false ]) : void
Parameters
- $throwException : bool = false
-
Throw exception upon API error, defaults to false
Return values
void —updateTemplate()
Update contract template
public
updateTemplate(string $templateId, string $name, string $content[, string $orientation = "0" ][, string $timezone = "UTC" ][, string $font = "Open Sans" ]) : array<string|int, mixed>
Parameters
- $templateId : string
-
Template ID
- $name : string
-
Template name
- $content : string
-
Template HTML content
- $orientation : string = "0"
-
0=Portrait(Default) 1=Landscape
- $timezone : string = "UTC"
-
Template timezone
- $font : string = "Open Sans"
-
Template font