Integrating DocuSign integration with a web application for electronic signature on website often encounters OAuth errors, incorrect anchor strings, or misconfigured webhooks. Typical issues include misconfigured redirect URIs, outdated SDK versions, and mismatched PDF tags. All this leads to runtime failures and lost deals. We specialize in such DocuSign API integration: we have completed over 30 projects where DocuSign is used for signing contracts, acts, and invoices. On average, our clients reduce document processing time by 40% and accelerate deal closure by 3 times. Embedded signing via DocuSign API improves completion rate by 3x compared to email signing, saving up to $1,500 per month in manual processing costs.
Why Choose DocuSign?
DocuSign is the market leader in electronic signatures in the US and Europe. It supports legally binding signatures under eIDAS (Europe), UETA/ESIGN (USA), and several national standards. For the Russian market: DocuSign provides a simple electronic signature (SES) that is recognized in court if there is an agreement between the parties—this is sufficient for most commercial contracts. For more details, see the Official DocuSign documentation.
How Integration Works?
Typical flow:
- User fills in data on the website → clicks "Sign contract"
- Backend creates an Envelope in DocuSign with the document and recipients
- User is redirected to DocuSign to sign (or receives an email)
- After signing, DocuSign notifies the site via webhook
- Backend downloads the signed document and saves it
We implement two scenarios: email sending or embedded signing—signing directly on the site. Comparison:
| Criteria | Email Signing | Embedded Signing |
|---|---|---|
| Interaction | User goes to DocuSign | Signing in iframe on your site |
| UX Control | Minimal | Full (design, redirect) |
| Completion Rate | ~70% | ~95% (3x fewer drop-offs) |
| Implementation Speed | 2-3 days | 4-5 days |
Application Setup
In DocuSign Developer Portal: create Integration Key → add redirect URI → request Secret Key. For testing—free Demo environment (account-d.docusign.com).
composer require docusign/esign-client
OAuth: Obtaining a Token
DocuSign uses OAuth 2.0 Authorization Code Grant:
class DocuSignAuthService
{
public function getAuthUrl(): string
{
$params = http_build_query([
'response_type' => 'code',
'scope' => 'signature',
'client_id' => config('docusign.integrator_key'),
'redirect_uri' => config('docusign.redirect_uri'),
]);
return 'https://account-d.docusign.com/oauth/auth?' . $params;
}
public function handleCallback(string $code): string
{
$response = Http::withBasicAuth(
config('docusign.integrator_key'),
config('docusign.client_secret')
)->asForm()->post('https://account-d.docusign.com/oauth/token', [
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => config('docusign.redirect_uri'),
]);
return $response->json('access_token');
}
}
For server-side scenarios without user interaction—JWT Grant (service account).
Creating an Envelope and Sending for Signature
class DocuSignEnvelopeService
{
public function createEnvelope(
string $accessToken,
string $pdfPath,
array $signers
): string {
$config = new \DocuSign\eSign\Configuration();
$config->setHost(config('docusign.base_url'));
$config->addDefaultHeader('Authorization', "Bearer {$accessToken}");
$apiClient = new \DocuSign\eSign\client\ApiClient($config);
$envelopesApi = new \DocuSign\eSign\Api\EnvelopesApi($apiClient);
$document = new \DocuSign\eSign\Model\Document([
'document_base64' => base64_encode(file_get_contents($pdfPath)),
'name' => 'Contract',
'file_extension' => 'pdf',
'document_id' => '1',
]);
$signHere = new \DocuSign\eSign\Model\SignHere([
'anchor_string' => '/sig1/',
'anchor_x_offset' => '20',
'anchor_y_offset' => '-10',
'anchor_units' => 'pixels',
]);
$recipientList = [];
foreach ($signers as $i => $signer) {
$tabs = new \DocuSign\eSign\Model\Tabs(['sign_here_tabs' => [$signHere]]);
$recipientList[] = new \DocuSign\eSign\Model\Signer([
'email' => $signer['email'],
'name' => $signer['name'],
'recipient_id' => (string)($i + 1),
'routing_order'=> (string)($i + 1),
'tabs' => $tabs,
]);
}
$envelopeDefinition = new \DocuSign\eSign\Model\EnvelopeDefinition([
'email_subject' => 'Please sign the document',
'documents' => [$document],
'recipients' => new \DocuSign\eSign\Model\Recipients([
'signers' => $recipientList,
]),
'status' => 'sent',
]);
$result = $envelopesApi->createEnvelope(
config('docusign.account_id'),
$envelopeDefinition
);
return $result->getEnvelopeId();
}
}
Embedded Signing: Signature Directly on the Site
Instead of redirecting to DocuSign—embedded iframe or redirect back to site:
public function getSigningUrl(string $accessToken, string $envelopeId, array $signer): string
{
$config = new \DocuSign\eSign\Configuration();
$config->setHost(config('docusign.base_url'));
$config->addDefaultHeader('Authorization', "Bearer {$accessToken}");
$apiClient = new \DocuSign\eSign\client\ApiClient($config);
$envelopesApi = new \DocuSign\eSign\Api\EnvelopesApi($apiClient);
$viewRequest = new \DocuSign\eSign\Model\RecipientViewRequest([
'authentication_method' => 'none',
'client_user_id' => $signer['id'],
'recipient_id' => '1',
'return_url' => route('contracts.signed'),
'user_name' => $signer['name'],
'email' => $signer['email'],
]);
$result = $envelopesApi->createRecipientView(
config('docusign.account_id'),
$envelopeId,
$viewRequest
);
return $result->getUrl();
}
Webhook: Notification of Signing
After signing, DocuSign sends XML with the new status. The server must process the request, verify that the status is Completed, and start downloading the document. We set up an endpoint that accepts POST requests and ensure it is accessible from the outside world. In production, HTTPS is mandatory.
Common Integration Errors
Most common errors:
- OAuth error: incorrect redirect URI or scope. Ensure the exact URI (including protocol and port) is specified in the app settings.
-
Anchor string mismatch: if the PDF document does not contain the specified anchor string, DocuSign will throw an error. Use tags like
/sig1/inside the original document. - Lost webhook: during testing, ensure the server is accessible from the external network (not localhost) and that DocuSign can send the request. In production, use HTTPS.
If you encounter these issues—our team can resolve them promptly.
What's Included in Our Integration Service
- Analysis of business processes and selection of the optimal scenario (email/embedded)
- DocuSign app setup (Integration Key, Secret, Redirect URI)
- API integration development: envelope creation, signing management
- Webhook integration for automatic status updates
- Embedded signing: iframe setup with custom settings
- Testing in demo environment and migration to production
- Operational documentation (admin instructions)
- Employee training on the new system
- Ongoing support after launch
We guarantee stable operation and timely support after launch. Contact us to discuss your project and find the best solution.
Our Experience and Results
We are a team with experience in DocuSign API integration. We have completed over 30 projects for companies in fintech, logistics, and retail. One client—a commercial real estate rental platform—reduced contract signing time from 3 days to 2 hours, and courier delivery costs dropped by 80%. Another project—a B2B e-commerce store—increased order processing speed by 60% thanks to automatic signing of payment invoices. The average time savings on document workflow is 40%, and the conversion of deal closing increases by 3 times. With savings up to $1,500 per month, our clients see rapid ROI.
Want the same results? Get a consultation—we will evaluate your system and propose an implementation plan.
Timeframes
Basic integration (envelope creation + email to signer + webhook): 2–3 business days. Embedded signing with full in-site flow and automatic document download: 4–5 business days. The estimate includes DocuSign app registration, testing in demo environment, and production migration.
Ready to discuss your project? Contact us for a detailed audit of your document workflow system. We will select the optimal solution for your budget and timeline.







