如何解决Tipsi-Stripe:无法从令牌创建源
绝对不知道这里可能是什么问题,我也不知道此错误意味着什么。尝试从令牌创建源时,出现此错误:
Unhandled Promise Rejection (id: 40):
Error: The payment method `card` requires the parameter: card[number].
Error: The payment method `card` requires the parameter: card[number].
at Object.promiseMethodWrapper [as createSourceWithParams] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2275:36)
at Stripe.createSourceWithParams (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:190106:29)
at payWithCard$ (http://localhost:8081/src/CheckoutForm.bundle?platform=ios&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:383:72)
at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28564:19)
at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28740:24)
at Generator.prototype.<computed> [as next] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28607:23)
at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28564:19)
at invoke (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28640:22)
at http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28650:15
at tryCallOne (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3475:14)
这是我的代码。我已经尝试了所有组合,但是我不确定卡[number]的含义。我的令牌绝对有效,并且我正在根据文档传递正确的值:https://tipsi.github.io/tipsi-stripe/docs/createsourcewithparamsparams.html
const options = {
requiredBillingAddressFields: 'full',theme: {
primaryBackgroundColor: '#f1f1f1',},};
const token = await stripe.paymentRequestWithCardForm(options);
const params = {
type: 'card',amount: 50,// currency: 'USD',// returnURL: 'example://stripe-redirect',card: token.card.cardId,// card: token.card,// card123: token.card.cardId,token: token.tokenId,};
console.log(token);
const source = await stripe.createSourceWithParams(params);
alert(source);
console.log(source);
任何建议将不胜感激。这是一个很大的图书馆,我会认为这个问题很普遍吗?谢谢。
解决方法
API已更改,并且文档未更新。这是新格式:
const source = await stripe.createSourceWithParams({
type: 'card',number: '5555555555554444',expMonth: 11,expYear: 29,cvc: '789',})
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。