使用 @stripe/stripe-react-native 处理 Stripe 时抛出错误
Error being thrown when dealing with Stripe using @stripe/stripe-react-native
我已将 Stripe 添加到我的 React-Native/Expo (SDK 42) 应用程序中。我正在尝试按照条纹网站上列出的“创建付款”方法进行操作,但它不断抛出以下错误:
undefined Unable to resolve module stripe from ../../../../.js stripe could not be found within the project.
我试过调用 Stripe,但我仍然不断收到错误消息。
下面是错误所在的代码:
import { CardField, useStripe, StripeProvider, Stripe } from '@stripe/stripe-react-native'
const stripe = require('stripe')('testKey')
const paymentMethod = async() => {
await stripe.paymentMethods.create({
type: 'card',
card:{
number: '4242424242424242',
exp_month: 9,
exp_year: 2022,
cvc: '314'
}
})
}
我根据 here
找到的 Node.js 版本改编了这个
我已将 Stripe 添加到我的 React-Native/Expo (SDK 42) 应用程序中。我正在尝试按照条纹网站上列出的“创建付款”方法进行操作,但它不断抛出以下错误:
undefined Unable to resolve module stripe from ../../../../.js stripe could not be found within the project.
我试过调用 Stripe,但我仍然不断收到错误消息。
下面是错误所在的代码:
import { CardField, useStripe, StripeProvider, Stripe } from '@stripe/stripe-react-native'
const stripe = require('stripe')('testKey')
const paymentMethod = async() => {
await stripe.paymentMethods.create({
type: 'card',
card:{
number: '4242424242424242',
exp_month: 9,
exp_year: 2022,
cvc: '314'
}
})
}
我根据 here
找到的 Node.js 版本改编了这个