braintree / braintree_python

Braintree Python library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
242 stars 115 forks source link

Cannot Update default payment method #66

Closed sparkline-charlie closed 8 years ago

sparkline-charlie commented 8 years ago

Hi,

Hope you can find some time to check on my problem.

Currently, i'm creating a maintenance application and display the payment method used by clients. Clients may have multiple payment method.

image

My concern here is i am not able to update the default payment method for the selected customer using this code.

result = braintree.CreditCard.update(token,{ "options": { "make_default": True, }, })

After checking the command prompt for any logs. I've found this

image

Below is the complete code of the method i've used.

image

Hope you can assist me. Thanks!

crookedneighbor commented 8 years ago

So far I have not been able to reproduce your issue. This code prints "success":

import braintree

braintree.Configuration.configure(
    braintree.Environment.Sandbox,
    "merchant_id",
    "public_key",
    "private_key"
)

token = "some-token"

result = braintree.CreditCard.update(token,{
    "options": {
        "make_default": True,
    },
})

if result.is_success:
    print 'success'
else:
    print 'error'
    print result.errors.size
    for error in result.errors.deep_errors:
        print error.code

You should contact Braintree Support since this seems to be a problem specific to your integration and not with the library. You can provide a link to this issue so they can quickly try to debug the issue. I'm going to close this issue, but the link to it will still be available for your and their reference.

As a side-note, I recommend switching from CreditCard.update to PaymentMethod.update. The CreditCard methods still work, but they are deprecated.