title: Adyen - Unable to decrypt data
body: <p>Hi i am trying to integrate adyen payment gateway in my project.
  I have used following PHP SDK <a href="https://github.com/Adyen/adyen-php-api-library" rel="nofollow noreferrer">Adyen PHP SDK</a></p>
  
  <p>i have followed the steps mentioned in the sdk to generate client side encryption and passed those encrypted value to server side to perform payment. But i was stuck with a error message "Unable to Decrypt data"</p>
  
  <p>Following is my sample code,</p>
  
  <p>Frontend :</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://test.adyen.com/hpp/cse/js/MY_LIBRARY_TOKEN.shtml"&gt;&lt;/script&gt;
    &lt;form method="POST"  id="adyen-encrypted-form"&gt;
      &lt;input placeholder="number" type="text" size="20" data-encrypted-name="number" value="2223520443560010" /&gt;
      &lt;input placeholder="holderName" type="text" size="20" data-encrypted-name="holderName" value="Ashok" /&gt;
      &lt;input placeholder="expiryMonth" type="text" size="2" data-encrypted-name="expiryMonth" value="10" /&gt;
      &lt;input placeholder="expiryYear" type="text" size="4" data-encrypted-name="expiryYear" value="2020" /&gt;
      &lt;input placeholder="cvc" type="text" size="4" data-encrypted-name="cvc" value="737" /&gt;
      &lt;input type="hidden" value="&lt;?php echo date('Y-m-d\TH:i:sO'); ?&gt;" data-encrypted-name="generationtime"/&gt;
      &lt;input type="submit" value="Pay"/&gt;
   &lt;/form&gt;
  
  &lt;script&gt;
      // The form element to encrypt.
      var form = document.getElementById('adyen-encrypted-form');
  
      var options = {};
      // Bind encryption options to the form.
      var encryptedBlobFieldName = "myFieldName";
      options.name = encryptedBlobFieldName;
      options.onsubmit = function(e) {
          var encryptedData = form.elements[encryptedBlobFieldName].value;
          // Encrypted form detials
          console.log(encryptedData);
          e.preventDefault();
      };
  var result = adyen.createEncryptedForm(form, options);
  &lt;/script&gt;
  </code></pre>
  
  <p>I get the encrypted value from above submit action with the test deails as i have populated in the form. (i.e) encryptedData</p>
  
  <p>Server Code :</p>
  
  <pre><code>$client = new \Adyen\Client();
  $client-&gt;setApplicationName("Adyen PHP Api Library Example");
  $client-&gt;setUsername("WS_USERNAME");
  $client-&gt;setPassword("WS_USER_PASSWORD");
  $client-&gt;setEnvironment(\Adyen\Environment::TEST);
  $service = new \Adyen\Service\Payment($client);
  $result = $service-&gt;authorise($params);
  </code></pre>
  
  <p>Following is the values i pass to authorise method, </p>
  
  <pre><code>Array(
  [amount] =&gt; Array
      (
          [value] =&gt; 19
          [currency] =&gt; GBP
      )
  
  [reference] =&gt; payment-test
  [merchantAccount] =&gt; MERCHANT_ACCOUNT_CODE
  [additionalData] =&gt; Array
      (
          [card.encrypted.json] =&gt; 'ENCRYPTED_DATA_FROM_FRONT_END'
      )
  )
  </code></pre>
  
  <p>Am not sure what am i doing wrong, from the server side i receive a error as unable to decrypt the data. Please assist me to resolve this issue</p>