title: Magento 2 - Programatically Add Credit Card into Vault (BrainTree)
body: <p>I need to Add Credit Card details in to Vault Programmatically (BrainTree) in Magento 2.1.5</p>
  
  <p>Basically what i want is After LoginIn there will be a separate section for Saved Cards . In that Customer is used to Add/edit/delete All his Credit card details.</p>
  
  <p>the Below Code is used to list all the Credit Card saved by the Customer</p>
  
  <pre><code> use Magento\Vault\Api\PaymentTokenManagementInterface;
   use Magento\Customer\Model\Session;
  
   ... 
  
   // Get the customer id (currently logged in user)
   $customerId = $this-&gt;session-&gt;getCustomer()-&gt;getId();
  
   // Card list
   $cardList = $this-&gt;paymentTokenManagement-&gt;getListByCustomerId($customerId);
  </code></pre>
  
  <p>Now what i want is how to Add the Card Details to the Vault ?</p>
  
  <p>Below is the Code to Add card in core php </p>
  
  <pre><code> $result = Braintree_Customer::create(array(
              'firstName' =&gt; 'first name',
              'lastName' =&gt; 'last name',
              'company' =&gt; 'company',
              'email' =&gt; 'xxxx@gmail.com',
              'phone' =&gt; '1234567890',
              'creditCard' =&gt; array(
                  'cardholderName' =&gt; 'xxx xxx',
                  'number' =&gt; '4000 0000 0000 0002 ',
                  'expirationMonth' =&gt; '10',
                  'expirationYear' =&gt; 2020,
                  'cvv' =&gt; '123',
                  'billingAddress' =&gt; array(
                      'firstName' =&gt; 'My First name',
                      'lastName' =&gt; 'My Last name'
                  )
              )
          ));
  </code></pre>
  
  <p>But how can i do this same process in magento 2.</p>
  
  <p>Thanks for the help</p>