简体   繁体   English

条纹类型错误:无法读取未定义的属性“payment_intent”

[英]Stripe TypeError: Cannot read property 'payment_intent' of undefined

I'm integrating the payment methods to the app with Stripe and Paypal and now working on Stripe integration.我正在使用 Stripe 和 Paypal 将付款方式集成到应用程序中,现在正在进行 Stripe 集成。

The backend is Node, Sails.js, and the frontend is React.js.后端是 Node、Sails.js,前端是 React.js。

I followed the guide they provided but and tested the payment processing using testing card.我遵循了他们提供的指南,但使用测试卡测试了付款处理。

But I got the error, which says TypeError: Cannot read property 'payment_intent' of undefined .但是我收到了错误,它说TypeError: Cannot read property 'payment_intent' of undefined

Here is my code.这是我的代码。

- Frontend
this.props.stripe.createPaymentMethod({
    type: 'card',
    card: cardElement,
}).then(({paymentMethod}) => {
// API call
})


- Backend
subscribe = await stripe.subscriptions.create({
     customer: customerId,
     items: [
        {price: plan.stripe.stripeId},
     ],
     expand: ['latest_invoice.payment_intent']
});

Please help me to fix this issue.请帮我解决这个问题。

In my opinion you don't have to create the PaymentIntent per subscrition.在我看来,您不必为每个订阅创建 PaymentIntent。

Here is what Stripe API docs says about paymentIntent.以下是 Stripe API 文档中关于 paymentIntent 的内容。

A PaymentIntent guides you through the process of collecting a payment from your customer. PaymentIntent 将指导您完成从客户处收取款项的过程。 We recommend that you create exactly one PaymentIntent for each order or customer session in your system.我们建议您为系统中的每个订单或客户会话准确创建一个 PaymentIntent。 You can reference the PaymentIntent later to see the history of payment attempts for a particular session.您可以稍后参考 PaymentIntent 以查看特定会话的付款尝试历史记录。

So they recommend to create the paymentIntent per transaction and in subscription case, the payment is proceed in background automatically and paymentIntent is also generated in my experience.因此,他们建议为每笔交易创建 paymentIntent,在订阅的情况下,付款会在后台自动进行,并且根据我的经验,也会生成 paymentIntent。

But on the other hand in checkout option, you need to create the paymentIntent first before proceeding the payment.但另一方面,在结帐选项中,您需要在继续付款之前先创建 paymentIntent。

I think you code was not wrong but I think you didn't follow the correct guide from Stripe or used wrong credit card.我认为您的代码没有错,但我认为您没有遵循Stripe的正确指南或使用错误的信用卡。

Please refer this link: Stripe API Payment_intents请参考此链接: Stripe API Payment_intents

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Stripe Connect PaymentIntent 错误:没有这样的 payment_intent - Stripe Connect PaymentIntent error: No such payment_intent 在angularJS / NodeJS中使用条带支付方法Stripe.charges.create({})时,“未捕获的TypeError:无法读取未定义的属性'create'” - “Uncaught TypeError: Cannot read property 'create' of undefined” while using stripe payment method Stripe.charges.create({}) in angularJS/NodeJS UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined (Connecting to Stripe) - UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined (Connecting to Stripe) 类型错误:无法读取未定义的属性“forEach”(节点 js、stripe、express) - TypeError: Cannot read property 'forEach' of undefined (node js, stripe, express) 无法读取未定义的属性“意图” - Cannot read property 'intent' of undefined 将 Stripe 平台客户克隆到关联账户客户时出现问题 - 没有这样的 payment_intent: 'pi_abc...zyx' - Issues cloning a Stripe platform customer to a Connected Account Customer - No such payment_intent: 'pi_abc...zyx' 条纹:无法读取对象处未定义的属性“令牌” - Stripe: Cannot read property 'token' of undefined at object 错误:TypeError:无法读取stripe.fileUploads.create上未定义的属性“ create” - ERROR: TypeError: Cannot read property 'create' of undefined on stripe.fileUploads.create 导致TypeError的Striping PaymentIntent.create:无法读取未定义的属性“ create”(Google云函数) - Stripe PaymentIntent.create causing TypeError: Cannot read property 'create' of undefined (google cloud functions) UnhandledPromiseRejectionWarning TypeError:无法读取未定义的属性“属性” - UnhandledPromiseRejectionWarning TypeError: Cannot read property 'property' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM