[Answered ]-Set change payment method to default braintree drop-in ui

1๐Ÿ‘

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

There are some things worth noting about setting the default payment method.

Hopefully that helps

1๐Ÿ‘

Add the defaultFirst option to the braintree.setup and your set default payment method will be automatically selected and show in the drop-in UI.

braintree.setup("{{ client_token }}", "dropin", {
    container: "checkout",
    form: "checkoutForm",
    defaultFirst: true
});

Feature added in braintree JS v2.24.0

Documentation: https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#setup-method-options

Source: https://github.com/braintree/braintree-web/issues/76#issuecomment-244162120

0๐Ÿ‘

i Solved this issue by deleting the payment method immediate after failed or successful transaction.

views.py

payment_method_result = braintree.Transaction.sale({
                                        "customer_id": merchant_customer_id,
                                        "amount": am,
                                        "options": {
                                                    "submit_for_settlement": True
                                                  }
                                    })
                # print dir(payment_method_result.transaction)
                # print payment_method_result
                # print payment_method_result.transaction
   try:
      result = braintree.PaymentMethod.delete(payment_method_result.transaction.credit_card['token'])
   except:
      pass

as it was one time payment, it did not affected much by deleting the user payment method.
In transaction anyway i can see the details.
Hope this will help some one.

Leave a comment