0

I try to use the docusign api in my symfony project. I followed the php sdk documentation.

I want to call the api to create enveloppe and send document.

public function signatureRequestFromTemplate(){
    $username = 'myUsername';
    $password = 'pswd';
    $integrator_key = $this->integratorKey;
    // change to production (www.docusign.net) before going live
    $host = "https://demo.docusign.net/restapi/v2";

    // create configuration object and configure custom auth header
    $config = new DocuSign\eSign\Configuration();
    $config->setHost($host);
    $config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password"\",\"IntegratorKey\":\"" . $integrator_key . "\"}");

    // instantiate a new docusign api client
    $apiClient = new DocuSign\eSign\ApiClient($config);
    $accountId = null;
    try{
        //*** STEP 1 - Login API: get first Account ID and baseURL
        $authenticationApi = new DocuSign\eSign\Api\AuthenticationApi($apiClient);
        $options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();
        $loginInformation = $authenticationApi->login($options);
    }
//........//
}

After this step i have an exception:

Exception: API call to https://demo.docusign.net/restapi/v2/login_information failed: SSL certificate problem: unable to get local issuer certificate

What i have to do? Or do you have a easily way to integrate this api with symfony?

Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
Moh
  • 39
  • 1
  • 11

1 Answers1

0

The error you're facing does not originate from your code but from your PHP setup using outdated SSL root certificates. The exception is pretty clear about this:

Exception: API call to https://demo.docusign.net/restapi/v2/login_information failed: SSL certificate problem: unable to get local issuer certificate

In order to resolve your problem you need to download a set of up-to-date root certificates and update your PHP configuration. The process is described in this answer.

The exception should vanish as soon as you configure both openssl.cafile and curl.cainfo to point to an up-to-date set of root certificates.

Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
  • thank you! I understood this exception. Now i have SSL certificate up-to-date but it doesn't work!!! I think it's not the good way to authenticate et send a document with docusign. I did not understood everything in the documentation. So i am searching an example code to do this with php. – Moh Oct 05 '18 at 14:56