0

私は残りのAPIを使用して埋め込み署名を実装することにかなり慣れていません。iframe 内で署名セッションを開始できますが、ドキュメント/テンプレートを終了した後、URL にリダイレクトされます。誰でも、リダイレクト URL を構成する方法または場所を教えてください。URL には、アプリ内でこのトークンを使用できる場所からのステータスが追加されていると思います。

ネバーマインド..わかった、そもそもそんなの見られないなんて信じられない。

// STEP 3 - Get the Send View           

    String reqBody = "<recipientViewRequest xmlns=\"http://www.docusign.com/restapi\">"  +
            "<authenticationMethod>email</authenticationMethod>" + 
            "<email>test@email.com</email>" + 
            **"<returnUrl>http://www.docusign.com</returnUrl>" +** 
            "<clientUserId>1</clientUserId>" + 
            "<userName>" + recipientName + "</userName>" + 
            "</recipientViewRequest>";
4

1 に答える 1

2

ご自身の質問に回答されたようですが、コミュニティのために、DocuSign API レシピの 1 つに埋め込み署名のすべての手順が示されています。

コードの完全な PHP バージョンは次のとおりです。お気づきのように、リクエスト本文でreturnUrlプロパティを 設定することにより、署名後にユーザーがリダイレクトされる URL を設定できます。

埋め込み署名用の完全な PHP プログラムは次のとおりです。これもここで見つけることができます

<?php

    // Input your info:
    $integratorKey = '...';
    $email = '...@....com';
    $password = '...';
    $name = "John Doe";

    // copy the templateId of an existing template here
    $templateId = "C9D9D181-CE57-.....................";

    // construct the authentication header:
    $header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 1 - Login (retrieves baseUrl and accountId)
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $url = "https://demo.docusign.net/restapi/v2/login_information";
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    if ( $status != 200 ) {
        echo "error calling webservice, status is:" . $status;
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $accountId = $response["loginAccounts"][0]["accountId"];
    $baseUrl = $response["loginAccounts"][0]["baseUrl"];
    curl_close($curl);

    //--- display results
    echo "accountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 2 - Create an envelope with an Embedded recipient (uses the clientUserId property)
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $data = array("accountId" => $accountId, 
        "emailSubject" => "Hello World!",
        "emailBlurb" => "This comes from PHP",
        "templateId" => $templateId, 
        "templateRoles" => array(
            array( "email" => $email, "name" => $name, "roleName" => "Signer1", "clientUserId" => "1001" )),
        "status" => "sent");                                                                    

    $data_string = json_encode($data);  
    $curl = curl_init($baseUrl . "/envelopes" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string),
        "X-DocuSign-Authentication: $header" )                                                                       
    );

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ( $status != 201 ) {
        echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
        print_r($json_response); echo "\n";
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $envelopeId = $response["envelopeId"];
    curl_close($curl);

    //--- display results   
    echo "Envelope created! Envelope ID: " . $envelopeId . "\n"; 

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 3 - Get the Embedded Singing View 
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $data = array("returnUrl" => "http://www.docusign.com/devcenter",
        "authenticationMethod" => "None", "email" => $email, 
        "userName" => $name, clientUserId => "1001"
    );                                                                    

    $data_string = json_encode($data);    
    $curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string),
        "X-DocuSign-Authentication: $header" )                                                                       
    );

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ( $status != 201 ) {
        echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
        print_r($json_response); echo "\n";
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $url = $response["url"];

    //--- display results
    echo "Embedded URL is: \n\n" . $url . "\n\nNavigate to this URL to start the embedded signing view of the envelope\n"; 
?>
于 2013-09-12T17:50:25.637 に答える