braintree/braintree_php — pull request #47 by stevenmaguire (2014-07-16 13:18:21+00:00)
Title: Update existing payment method functionality

Problem
-------------

The documentation references code that does not appear to exist. It indicates an ability to update an existing payment method by providing the token and a new nonce. The library did not appear to offer such an ability.

Solution
-------------

I utilized the token delete operation to remove any conflicting payment methods and upon successful removal, created a new token with "update" information using the same token.

Background
-------------

The documentation makes multiple references[1,2] to an "update" method that is expected to be available in a "Braintree_PaymentMethod" class.

The "Braintree_PaymentMethod" class does not contain an "update" method[3], nor does its abstract parent class "Braintree" contain an "update" method[4].

These observations lead me to believe that the error I am experiencing[5] is appropriate but not expected or desired, and that a code snippet invoking a non-existent method is not the most valuable information at this time.

References:
1: https://developers.braintreepayments.com/javascript+php/sdk/server/payment-method-management/update
2: https://developers.braintreepayments.com/javascript+php/sdk/server/payment-method-management/verifications
3: https://github.com/braintree/braintree_php/blob/master/lib/Braintree/PaymentMethod.php
4: https://github.com/braintree/braintree_php/blob/master/lib/Braintree.php
5: Error: "Call to undefined method Braintree_PaymentMethod::update()"