Search code examples
androidbraintree

Is there any way to store credit/debit card detail for future use Using Braintree Android SDK


I am using Braintree SDK in my android app for payments and its working fine, But here is one problem it asks every time credit/debit card details. So my question is, is there any way to store credit/debit card detail for next time payments without asking again credit card detail for the same user.


Solution

  • Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

    You can store credit cards and other payment methods in the Braintree Payment Method Vault associated with your Braintree account. Payment methods are associated directly to customer records, and customers may have more than one payment method associated with them.

    To present a customer with their payment methods during checkout, you have two options. If you're using a custom integration, you can check the customer object for associated payment methods then look up the details for each payment method in turn. If you're using the Drop-in, you have a simpler option.

    The Drop-in form automatically fetches a customer's payment methods when it is presented with a customer ID. To present it with a customer ID, first generate a client token using a customer ID, then use that client token to initialize the Drop-in.

    ClientTokenRequest clientTokenRequest = new ClientTokenRequest()
        .customerId(aCustomerId);
    String clientToken = gateway.clientToken().generate(clientTokenRequest);