title: Encrypting credit card details using AngularJS in Braintree
body: <p>I am using Braintree for payment gateway and I have across an issue.<br>
  I am sending credit card information with other user details.  </p>
  
  <p>For security purposes Credit card information has to be encrypted and it is being done by Braintree by including following:  </p>
  
  <pre><code>braintree.onSubmitEncryptForm('braintree-payment-form');
  </code></pre>
  
  <p>This works fine until I use pure javascript (AngularJS) in front-end and I'm seeing that data is not encrypted while sending to server,<br>
  Here  is code:    </p>
  
  <pre><code>&lt;form name="paymentForm" ng-submit="submitUser(userDetails)" method="post" id="braintree-payment-form"&gt;
  &lt;p&gt;
    &lt;label style="color:white"&gt;Name&lt;/label&gt;
    &lt;input type="text" ng-model="userDetails.userName" name="userName" size="20" /&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label style="color:white"&gt;Email&lt;/label&gt;
    &lt;input type="text" ng-model="userDetails.email" name="email" size="20"/&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label style="color:white"&gt;Company&lt;/label&gt;
    &lt;input type="text" ng-model="userDetails.company" name="company" size="20" /&gt;
  &lt;/p&gt;
    &lt;label style="color:white"&gt;Card Number&lt;/label&gt;
    &lt;input type="text" size="20" ng-model="userDetails.number" autocomplete="off" data-encrypted-name="number" /&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label style="color:white"&gt;CVV&lt;/label&gt;
    &lt;input type="text" size="4" ng-model="userDetails.cvv" autocomplete="off" data-encrypted-name="cvv" /&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label style="color:white"&gt;Expiration (MM/YYYY)&lt;/label&gt;
    &lt;input type="text" size="2" ng-model="userDetails.month" data-encrypted-name="month" /&gt; / &lt;input type="text" size="4" ng-model="userDetails.year" data-encrypted-name="year" /&gt;
  &lt;/p&gt;
  &lt;input type="submit" id="submit" /&gt;
  </code></pre>
  
  <p>  </p>
  
  <p>On form submit, I am sending data to server.  </p>
  
  <pre><code>$scope.submitUser = function(userDetails){
      $http({
          url: '/createtransaction',
          method: 'POST',
          data: JSON.stringify(userDetails),
          headers: {'Content-Type': 'application/json'}
      }).success(function (data, status, headers, config) {
          // success
      }).error(function (data, status, headers, config) {
          //error
      });
  }
  </code></pre>
  
  <p>Is there anyway I can encrypt card details?</p>