StripeCheckout.open中的错误处理在哪里?
Where is the error handling in StripeCheckout.open?
我使用以下代码成功创建了一个收费令牌:
StripeCheckout.open({
key: 'pk_test_99999999999999999',
amount: 2000,
name: 'XYZ',
description: 'Your Order',
panelLabel: 'Pay Now',
token: function(res) {
//do something with the token, but where is the error handling?
}
});
我错过了什么吗?如果客户输入无效卡或其他内容,错误处理在哪里?还是会一直生成收费令牌,只有在服务器上实际创建收费时才会出现错误?
有一个关闭的回调可以在结帐关闭时调用,但只有在生成令牌时结帐才会自行关闭。由于您传递的是金额,Checkout 将对卡进行 0 美元/1 美元的授权以确保其有效性,但当您尝试在服务器端向卡收费时,卡仍可能会被拒绝。
我使用以下代码成功创建了一个收费令牌:
StripeCheckout.open({
key: 'pk_test_99999999999999999',
amount: 2000,
name: 'XYZ',
description: 'Your Order',
panelLabel: 'Pay Now',
token: function(res) {
//do something with the token, but where is the error handling?
}
});
我错过了什么吗?如果客户输入无效卡或其他内容,错误处理在哪里?还是会一直生成收费令牌,只有在服务器上实际创建收费时才会出现错误?
有一个关闭的回调可以在结帐关闭时调用,但只有在生成令牌时结帐才会自行关闭。由于您传递的是金额,Checkout 将对卡进行 0 美元/1 美元的授权以确保其有效性,但当您尝试在服务器端向卡收费时,卡仍可能会被拒绝。