Reload Braintree Drop-In UI After Payment Method Delete

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Reload Braintree Drop-In UI After Payment Method Delete



When I perform, this.gateway.paymentMethod.delete(response.paymentMethod.token);, is there any way to reload the Drop-In UI to explicitly show the user that their payment method has been deleted? In other words, the payment method is removed from the list of payment methods within the Drop-In UI.


this.gateway.paymentMethod.delete(response.paymentMethod.token);




1 Answer
1



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



You can reload the Drop-in UI by using the teardown method on the Drop-in instance, followed by a subsequent braintree.dropin.create() call. The teardown method will cleanly remove everything setup by a dropin.create call. You can use the method similarly to this:


teardown


braintree.dropin.create()


teardown


dropin.create


instance.teardown(function (teardownErr)
if (teardownErr)
console.error('Could not tear down Drop-in UI!');
else
console.info('Drop-in UI has been torn down!');

);



Once the Drop-in is torn down, you can then call braintree.dropin.create() again to setup the Drop-in to display the customer's accurate stored payment methods.


braintree.dropin.create()



While slightly different implementation, there is an example of the teardown method in this tutorial.


teardown



UPDATE: A newer version of the Drop-in UI was just released that allows customers to delete their payment methods from within the Drop-in. You can use this by upgrading to the latest version of the Drop-in (v1.12.0).



Once you've upgraded, set vaultManager to true within your braintree.dropin.create() call, similar to this:


vaultManager


true


braintree.dropin.create()


braintree.dropin.create(
authorization: 'CLIENT_AUTHORIZATION',
container: '#dropin-container',
vaultManager: true
, callback);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS