Support » Plugin: WooCommerce PayPal Powered by Braintree Payment Gateway » “Duplicate card exists in the vault” Revisited!

  • Resolved danabel


    I am having the same issue as this issue, but it is not resolved for me.

    I have been in touch with Braintree and they say: “This error happens when your PaymentMethod.Create() calls are passing the FailOnDuplicatePaymentMethod option as true.”

    This option is being set in the get_credit_card_options() function of the WC_Braintree_API_Vault_Request class on line 73 of includes/api/requests/abstract-wc-braintree-api-vault-request.php.

    The issue is that because of this option your plugin does not allow users to use the same credit card for multiple WordPress accounts using the same Braintree vault. This is especially a problem if you are using the same Braintree vault for more than one website as we are, or if multiple people (e.g. family members) choose to use the same credit card for different accounts. Both of these scenarios should be aloud.

    Please could you change this setting to false, or at least allow users to change it in the settings. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Here’s a patch if it’s useful:

    diff --git a/includes/api/requests/abstract-wc-braintree-api-vault-request.php b/includes/api/requests/abstract-wc-braintree-api-vault-request.php
    index b6ef7a0..0edbab8 100644
    --- a/includes/api/requests/abstract-wc-braintree-api-vault-request.php
    +++ b/includes/api/requests/abstract-wc-braintree-api-vault-request.php
    @@ -70,7 +70,7 @@ abstract class WC_Braintree_API_Vault_Request extends WC_Braintree_API_Request {
     	protected function get_credit_card_options() {
     		$options = array(
    -			'failOnDuplicatePaymentMethod' => true,
    +			'failOnDuplicatePaymentMethod' => false,
     			'verifyCard'                   => true,
    • This reply was modified 9 months, 3 weeks ago by  danabel.
    Plugin Support Julia Amosova


    Automattic Happiness Engineer

    Hi @danabel,

    Thanks for bringing this up to our attention! And thanks for providing the details of how you currently fixed the issue.

    I passed these details to the development team and waiting for their response. I will post back here as soon as I receive an answer from them.

    Thanks for your patience!



    we have this issue also occasionally, where does this patch go?


    There is a better solution for this. No need to touch the plugin’s code.

    add_filter( 'wc_braintree_api_request_data', 'allow_duplicate_card' );
    public function allow_duplicate_card( $request_data ) {
     if ( isset( $request_data['options'], $request_data['options']['failOnDuplicatePaymentMethod'] ) ) {
      $request_data['options']['failOnDuplicatePaymentMethod'] = false;
     return $request_data;
    • This reply was modified 8 months, 2 weeks ago by  poglaa.
    Plugin Support John Coy


    Automattic Happiness Engineer

    Hi all,

    It’s recommended to use the wc_braintree_api_request_data filter to adjust that parameter as you see fit. The default expectation is for there to be an error if the same card is added to two different users.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“Duplicate card exists in the vault” Revisited!’ is closed to new replies.