[英]Reload Braintree Drop-In UI After Payment Method Delete
When I perform, this.gateway.paymentMethod.delete(response.paymentMethod.token);
当我执行时,
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? ,是否有任何方法可以重新加载Drop-In UI,以明确向用户显示其付款方式已被删除? In other words, the payment method is removed from the list of payment methods within the Drop-In UI.
换句话说,付款方式已从Drop-In UI中的付款方式列表中删除。
Full disclosure: I work at Braintree. 全面披露:我在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. 您可以通过使用Drop-in实例上的
teardown
方法并随后进行随后的braintree.dropin.create()
调用来重新加载Drop-in UI。 The teardown
method will cleanly remove everything setup by a dropin.create
call. teardown
方法将通过dropin.create
调用彻底删除所有设置。 You can use the method similarly to this: 您可以使用与此类似的方法:
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()
后,您可以再次调用braintree.dropin.create()
来设置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. 更新:刚刚发布了一个新版本的Drop-in UI,它允许客户从Drop-in中删除其付款方式。 You can use this by upgrading to the latest version of the Drop-in (v1.12.0) .
您可以通过升级到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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.