• I have the latest WP and PMPro, which comes with Braintree built-in. However, I’m trying to do standard credit card payments using Braintree, and it keeps throwing an error saying it is not able to create a Customer in Braintree. I’ve done some digging and I think the PMPro Braintree code is out-dated, as it is trying to use deprecated options for the Braintree API.

    See here: https://developers.braintreepayments.com/reference/request/customer/create/php#credit_card.cvv

    This matches up with the error I keep getting from Braintree:
    Failed to create customer. CVV must be 4 digits for American Express and 3 digits for other card types. Expiration date is invalid. Credit card number must be 12-19 digits.

    This lines up with the code in /paid-memberships-pro/classes/gateways/class.pmprogateway_braintree.php starting on line 596:

    try
    {
        $result = Braintree_Customer::create(array(
            'firstName' => $order->FirstName,
            'lastName' => $order->LastName,
            'email' => $order->Email,
            'phone' => $order->billing->phone,
            'creditCard' => array(
                'number' => $order->braintree->number,
                'expirationDate' => $order->braintree->expiration_date,
                'cvv' => $order->braintree->cvv,
                'cardholderName' =>  trim($order->FirstName . " " . $order->LastName),
                'billingAddress' => array(
                    'firstName' => $order->FirstName,
                    'lastName' => $order->LastName,
                    'streetAddress' => $order->Address1,
                    'extendedAddress' => $order->Address2,
                    'locality' => $order->billing->city,
                    'region' => $order->billing->state,
                    'postalCode' => $order->billing->zip,
                    'countryCodeAlpha2' => $order->billing->country
                )
            )
        ));
    
        if($result->success)
        {
            $this->customer = $result->customer;
        }
        else
        {
            $order->error = __("Failed to create customer.", "pmpro") . " " . $result->message;
            $order->shorterror = $order->error;
            return false;
        }
    }

    This is the main payment gateway I need for a site I’m trying to launch ASAP, so I will try and hack the plugin to fix it for the time being.

    https://www.ads-software.com/plugins/paid-memberships-pro/

Viewing 1 replies (of 1 total)
  • Hello,
    i am having the same error msg.
    It does look like the class is deprecated,
    any plan to update this ?
    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Braintree Checkout Errors’ is closed to new replies.