Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 12:57pmI tried the using the following but the code is a bit dated.
https://community.onespan.com/documentation/onespan-sign/codeshare/php-web-form-application-example
How to add Signatures required for the document?
Reply to: Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 01:20pmHi Classic,
Welcome to our community!
I have attached an example in PHP. Simply replace the API Key with your owns and you will be able to create and send a package.
Below package JSON was used in this example:
{
"roles": [
{
"id": "Signer1",
"signers": [
{
"email": "[email protected]",
"firstName": "John",
"lastName": "Smith"
}
]
}
],
"documents": [
{
"approvals": [
{
"role": "Signer1",
"fields": [
{
"page": 0,
"top": 100,
"subtype": "FULLNAME",
"height": 50,
"left": 100,
"width": 200,
"type": "SIGNATURE"
}
]
}
],
"name": "Test Document"
}
],
"name": "PHP Example Package",
"language": "en",
"status": "SENT"
}
Customize the JSON (schema here) and you can design the package according to your requirement.
Duo
Reply to: Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 04:11pmMOD DELETE
Reply to: Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 04:50pmMOD DELETE
Reply to: Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 05:56pmMOD DELETE
Reply to: Adding Signatures/Approvals [PHP]
Thursday, February 23, 2023 at 06:36pmThanks for the reply! It guided me in the right direction!
Reply to: Adding Signatures/Approvals [PHP]
Tuesday, February 28, 2023 at 11:32amHi,
Is it possible to get the token and iframe the URL for signer? I am able to get the token using the referenced codebase but having difficulty with your code.
Reply to: Adding Signatures/Approvals [PHP]
Tuesday, February 28, 2023 at 12:50pmI see, when defining package JSON, also set "id" under "signers" array:
$json = [
"roles" => [
[
"id" => "Signer1",
"signers" => [
[
"email" => "[email protected]",
"firstName" => "John",
"lastName" => "Smith",
"id" => "Signer1",
]
]
]
],
"documents" => [
[
"approvals" => [
[
"role" => "Signer1",
"fields" => [
[
"page" => 0,
"top" => 100,
"subtype" => "FULLNAME",
"height" => 50,
"left" => 100,
"width" => 200,
"type" => "SIGNATURE"
]
]
]
],
"name" => "Test Document"
]
],
"name" => "PHP Example Package",
"language" => "en",
"status" => "SENT"
];
I've attached an updated code.
Duo
Reply to: Adding Signatures/Approvals [PHP]
Monday, March 13, 2023 at 04:12pmHi Duo,
Thank you.
Is it possible to upload a second document and use the approval on that document page 0 versus counting how many pages in the initial document?
Reply to: Adding Signatures/Approvals [PHP]
Tuesday, March 14, 2023 at 09:07amHi Classic,
If you don't know the exact location to place signatures/fields before hand, there are many options to follow:
(1)You can use extraction methods like Text Tags or Document Extraction to automatically place signatures and fields
(2)Or you can use either Position Extraction or Text Anchors to locate the field, then reference the field in JSON
Among above four solutions,
#1 Document Extraction and Position Extraction use PDF form fields,
#2 Text Tags and Text Anchors use the text, hence they can be used in any supported file types,
#3 Document Extraction, Position Extraction and Text Tags requires your doc team to add specific form/tag in the document, while Text Anchors can use the existing content in the document, thus can be used when you don't have access to modify the document.
On top of above four options, upload a second document with signature on page 0 also works. In that case, if you are making document 1 accept only, and document 2 with signature, the package JSON could look like below:
{
"roles": [
{
"id": "Signer1",
"signers": [
{
"email": "[email protected]",
"firstName": "John",
"lastName": "Smith",
"id": "Signer1"
}
]
}
],
"documents": [
{
"approvals": [
{
"role": "Signer1",
"fields": []
}
],
"name": "Document1"
},
{
"approvals": [
{
"role": "Signer1",
"fields": [
{
"page": 0,
"top": 100,
"subtype": "FULLNAME",
"height": 50,
"left": 100,
"width": 200,
"type": "SIGNATURE"
}
]
}
],
"name": "Document2"
}
],
"name": "Example Package",
"language": "en",
"description": "New Package",
"status": "SENT"
}
Duo