How to integrate eSignature into PHP Applications?
Looking to streamline your document signing process in your PHP application? Integrating eSignature into PHP Applications is one of the most effective ways to automate approvals, enhance security, and eliminate paperwork delays. Whether you’re developing a CRM, HR tool, or a custom business portal, adding digital signature functionality can significantly improve user experience and operational efficiency.
In this blog, we’ll walk you through how to integrate eSignature into your PHP applications using a reliable digital signature API like KAiZEN. From setting up the environment to sending documents for signature, this step-by-step guide will help you go paperless with ease.
How to integrate eSignature into PHP Applications:
Step 1:
Identify the users which need to sign the document along with their levels or order hierarchy. Order means the sequence in which the signers will sign the document. A person with Order 2 will sign only after the person with order 1 has signed.
Let’s define the below two users which the order of signing.
Signer Information
Signer Name | Order | Signer Email |
---|---|---|
Signer 1 | 1 | signer1@gmail.com |
Signer 2 | 2 | signer2@gmail.com |
-
Step 2:
Need to make a secure HTTP Callout to call the KAiZEN “Initiate Sign API” request as per the below details:
HTTP Request Parameters
Parameters Name Value Content-Type application/json Method POST Endpoint https://fa-kaizen-prod.azurewebsites.net/api/Sign/RequestStr?code=RTa1A0GW5Yl92OF54-73lRqglLFCt_0pVcg86hWf1EjtAzFuNROcdA== Body JSON Body with parameters Request Body Parameters
Parameters Name Description Required? docContent Base64 Content for the PDF File Yes docName Name of the File Yes appToken Unique Code to initiate the request Yes requesterEmail Email address of the person initiating the request Yes requesterName Name of the person initiating the request Yes description Describes the document NO signers An array of the signers who needs to sign the document in the pre-defined order. Yes CallBackURL CallbackURL defines the url on which the KAiZEN should send a response once all the signers signs the document. It can be webservice url of Salesforce or any external page.
Eg: https://duumy.my.salesforce- sites.com/services/apexrest/KaizenCallbackURL/No newRequestEmailSubject Describes the email subject No requesterMessage Describes the prompt eSignature field No docDescription Describes the document No -
Step 3:
PHP Code Sample for Integration
<?php require_once 'HTTP/Request2.php'; $request = new HTTP_Request2(); $request->setUrl('https://fa-kaizen-staging.azurewebsites.net/api/Sign/RequestStr?code=mLgEBTpi9dfooQ6TB9gc7sa4qiIuuxmqQYoTx8nQQ1StAzFu93g06A=='); $request->setMethod(HTTP_Request2::METHOD_POST); $request->setConfig(array( 'follow_redirects' => TRUE )); $request->setHeader(array( 'Content-Type' => 'application/json' )); $request->setBody('{\n "docContent":"<
>",\n "requesterEmail": "xyz@gmail.com",\n "requesterName": "XYZ",\n "requesterPhone": "xxxxx-xxx-xxxx",\n "description" :"",\n "newRequestEmailSubject":"You have a document to sign",\n "requesterMessage": "Kindly eSign your KAiZEN Test PDF",\n "signers": [\n {\n "signerEmail": "signer1@gmail.com",\n "signerName": "Signer1",\n "signerPhone": "xx-xxx-xxxx-xxx",\n "order": "1",\n "signerRole": "signer"\n \n },{\n "signerEmail": "signer2@gmail.com",\n "signerName": "Signer2",\n "signerPhone": "xxx-xxx-xxxx-xxxx",\n "order": "2",\n "signerRole": "reviewer"\n \n }\n ],\n \n "docDescription": "Base 64 string based test doc",\n "callbackurl": ""\n}'); try { $response = $request->send(); if ($response->getStatus() == 200) { echo $response->getBody(); } else { echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase(); } } catch(HTTP_Request2_Exception $e) { echo 'Error: ' . $e->getMessage(); } Sample HTTP Response:
{ “FailRules”: [], “Data”: { “SignRequestId”: “01HV6MEARQD3X8ZXXX5FR3YDB8”, “RequestNo”: “KAiZEN-118” } }
Once the request is submitted, it will send a response with the request Id. If the callback url is configured, it will send a signed copy of the document on the defined url, once all the signers will sign and review the document.
Once the request is sent out to the signers, each signer will receive an email to sign the document in the order as defined in the request.
How KAiZEN eSign Works
-
Check Your Inbox
The signer will receive an email from KAiZEN with a prompt to sign the document.
-
Click to Start Signing
Inside the email, click the “Sign here” button. This opens the document in the secure KAiZEN signing editor.
-
Sign the Document
After clicking on the “Sign Here” button. You’ll get a popup where you can choose the following methods to eSign:
- Initials
- Draw your signature
- Upload an image of your signature
- Recently Used Signs
-
Submit and Done
Once you’ve placed your signature, click Submit. The next signer in the sequence will then be notified.
-
After All Signers Complete
Once every signer has completed the process:
- Each signer will receive an email with the final signed document.
- If a callback URL was configured, a copy of the signed document will be automatically sent to that system (e.g., Java or your application).
Conclusion
Integrating digital signatures in PHP with KAiZEN is a smooth and efficient way to automate document workflows while ensuring legal compliance and data integrity. With just a few lines of code, you can add secure, verifiable eSignatures to your applications.
👉 Try KAiZEN for free – Get your API key and start signing documents directly from your PHP projects today!
Sign up for Free
Trial today!
Try KAiZEN for free
