How can I send someone a document for signing using Adobe EchoSign API v5? For API version 5, I could only find an example using Java. But I need it in PHP. If I use any earlier version it requires an "API key", but in the current version of API, I can't find my API key. I can't even find any sample code in PHP.
4 Answers
There's no longer an API key in the current version as it now uses "Access Token". This is what I did on my PHP application.
- Store the Application ID and Client Secret and use it for requesting access token.
- If request is successful, store both access token and refresh token and the timestamp in your database.
- Access token will expire in 1 hour so you have to check if it already expires.
- If access token has expired. Request for refresh token and it should return a new access token.
- Replace the access token you stored with the new one you receive and regain access to the API.

- 68
- 5
I took me a while but I got it working, I hope it helps others, after installing with composer (https://github.com/kevinem/adobe-sign-php/) yo need to create your sandbox page, for me was a index.php in /vendor/kevinem/adobe-sign-php/ then you need to include 2 classes AdobeSign and Psr7 in my case, because I need to upload 2 documments.
require "../../../vendor/autoload.php";
use KevinEm\AdobeSign\AdobeSign;
use GuzzleHttp\Psr7;
this is how I configure my $provider, the call backurl must be the same as the one in the backend of adobe and I changed manually the data center in AdobeSign.php
$provider = new KevinEm\OAuth2\Client\AdobeSign([
'clientId' => 'YOUR_APP_ID',
'clientSecret' => 'YOUR_APP_SECRET',
'redirectUri' => 'YOUR_BACK_URL',
'dataCenter' => 'secure.na2',
'scope' => ['user_login:self',
'agreement_write:self',
'widget_write:self',
'library_write:self',
'agreement_send:self'
]
]);
Then u need to create an array with the URL of all your .pdf documents. my is call $archivos.
$accessToken = $adobeSign->getAccessToken($_GET['code']);
$adobeSign->setAccessToken($accessToken->getToken());
$todosDoc = array();
foreach ($archivos as $doc) {
$file_path = __DIR__.$doc;
$file_stream = Psr7\FnStream::decorate(Psr7\stream_for(file_get_contents($file_path)), [
'getMetadata' => function() use ($file_path) {
return $file_path;
}
]);
$multipart_stream = new Psr7\MultipartStream([
[
'name' => 'File',
'contents' => $file_stream
]
]);
$transient_document = $adobeSign->uploadTransientDocument($multipart_stream);
array_push($todosDoc, $transient_document);
}
$adobeSign->createAgreement([
'documentCreationInfo' => [
'fileInfos' => $todosDoc,
'name' => 'My Document Test',
'signatureType' => 'ESIGN',
'recipientSetInfos' => [
'recipientSetMemberInfos' => [
'email' => 'orlando@yoursigner.com'
],
'recipientSetRole' => [
'SIGNER'
]
],
'mergeFieldInfo' => [
[
'fieldName' => 'Name',
'defaultValue' => 'John Doe'
]
],
'signatureFlow' => 'SENDER_SIGNATURE_NOT_REQUIRED'
]
]);
-
Hi, i don't undestand how to use adobe sign with PHP. I need to send a PDF to someone. How can I add sign fields using PHP ?! is it possible? and how can receive back the signed PDF? must person send it back using an email or there is an automated way? – Giuseppe Lodi Rizzini May 05 '20 at 14:53
-
Where do you use $provider var? i tried your code but I get error Uncaught BadMethodCallException: Required parameter not passed: "code" – Giuseppe Lodi Rizzini May 11 '20 at 07:01
Adobe Sign has changed its authentication process and instead of using "API key", it now uses "Access-Token" which is more secure.
You can use any PHP based third part rest API client library for the Adobe Sign API calls until Adobe Sign itself provides the SDK for PHP.

- 74
- 5

- 11
- 3
-
how to obtain "Access-Token"? Can I get it without Oath? Or all my app users need to login into Adobe? – Toolkit Aug 12 '16 at 10:45
Adobe eSign is now using oAuth for authentication, and there are a lot of different libraries for different languag

- 1
- 2