【发布时间】:2020-04-02 23:02:04
【问题描述】:
我正在设置一个直接收费的标准条带连接帐户。
这对我使用带有令牌的收费 api 非常有效,但对于我使用欧盟要求的支付意图 api 时不起作用。
以下代码用于获取客户端密码。
axios.post(`${process.env.REACT_APP_API}/paymentIntent`, stripeData).then(res => {console.log('paymentIntent res', res.data)
let clientSecret = res.data.clientSecret
this.props.stripe.createToken({}).then(res => {
console.log('stripe token', res)
if (!res.token) {
this.setState({
message:
"Invalid Credit Card. Your tickets have not been booked. You have not been charged"
})
}
else{
this.props.stripe.confirmCardPayment(
clientSecret,
{
payment_method: {
card: {
token: res.token.id
}
}
}
).then( res => {console.log(res)})
}
})
}
但我在控制台中收到以下错误:
Failed to load resource: the server responded with a status of 404 ()
error:
code: "resource_missing"
doc_url: "https://stripe.com/docs/error-codes/resource-missing"
message: "No such payment_intent: pi_1FnrwXLkWxxxxxxxxxxxxxxx"
param: "intent"
type: "invalid_request_error"
有几件事让我感到困惑。
- 我的 clientSecret 代码格式为:
pi_1FnrwXLkWxxxxxxxxxxxxxxx_secret_pGBi46eAzWxxxxxxxxxxxxxxx
从错误消息看来,它似乎只有一部分被发送到条带 api。这是导致错误的原因吗?
-
两个条纹答案建议在前端使用以下代码。
var stripe = Stripe(STRIPE_PUBLIC_KEY, { stripeAccount: "{{ connected_account }}" })
如果这是正确的,我该如何调整此代码以进行反应以及将其放在组件中的什么位置?它现在给我一个错误。
参考1:Code=50 “No such payment_intent” when confirm payment intent for stripe
Ref2:Stripe Connect PaymentIntent error: No such payment_intent
- 在 Stripe 文档的其他地方,它说要使用 Payment Methods API 而不是带有 Payment Intents API 的令牌。我应该完全放弃使用令牌吗?
【问题讨论】:
标签: node.js reactjs stripe-payments