- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 Stripe 的 Connect 实现到我的应用程序中。我已经完成了数小时的研究和试错方法调试,现在我遇到的情况是没有出现技术错误,但出现错误:
Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number. You can use the the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance).
Stripe Dashboar 中的 paymentIntent 显示 PaymentIntent 状态:requires_confirmation
这个错误对我来说似乎很奇怪,因为我正在测试的卡正是他们建议我使用的卡。请注意,我还尝试过使用其他卡。
我使用 Google Cloud Functions 作为 Stipe API 的后端。
这是创建帐户
和客户
的函数。我创建它们只是为了确保一切正常。
// When a user is created in firebase auth, register them with Stripe
exports.createStripeUser = functions.auth.user().onCreate(async (user) => {
const account = await stripe.accounts.create({type: 'custom', business_type: 'individual', individual: {email: user.email}, requested_capabilities: ['card_payments', 'transfers'], email: user.email});
const customer = await stripe.customers.create({email: user.email});
return admin.firestore().collection('stripe_customers').doc(user.uid).set({account_id: account.id, customer_id: customer.id});
});
现在我正在添加卡信息:
// Add a payment source (card) for a user by writing a stripe payment source token to Cloud Firestore
exports.addPaymentSource = functions.firestore.document('/stripe_customers/{userId}/tokens/{pushId}').onCreate(async (snap, context) => {
const source = snap.data();
const token = source.token;
if (source === null){
return null;
}
try {
const snapshot = await admin.firestore().collection('stripe_customers').doc(context.params.userId).get();
const customer = snapshot.data().customer_id;
const response = await stripe.customers.createSource(customer, {source: token});
return admin.firestore().collection('stripe_customers').doc(context.params.userId).collection("sources").doc(response.fingerprint).set(response, {merge: true});
} catch (error) {
await snap.ref.set({'error':userFacingMessage(error)},{merge:true});
return reportError(error, {user: context.params.userId});
}
});
这就是我创建 paymentIntent
的方式:
// Create Stripe paymentIntent whenever an amount is created in Cloud Firestore
exports.createStripePaymentIntent = functions.firestore.document('stripe_customers/{userId}/charges/{id}').onCreate(async (snap, context) => {
const val = snap.data();
try {
// Look up the Stripe customer id written in createStripeUser
const snapshot = await admin.firestore().collection(`stripe_customers`).doc(context.params.userId).get()
const snapval = snapshot.data();
const customer = snapval.customer_id
const amount = val.amount;
const charge = {amount, currency, customer, transfer_group: val.transfer_group, payment_method: val.payment_method};
if (val.source !== null) {
charge.source = val.source;
}
const response = await stripe.paymentIntents.create(charge);
// If the result is successful, write it back to the database
return snap.ref.set(response, { merge: true });
} catch(error) {
// We want to capture errors and render them in a user-friendly way, while
// still logging an exception with StackDriver
console.log(error);
await snap.ref.set({error: userFacingMessage(error)}, { merge: true });
return reportError(error, {user: context.params.userId});
}
});
现在一切似乎都按预期进行,现在进入了有趣的部分,即转移。由于上述错误,我无法做到这一点。这就是我创建费用的方式:
exports.createStripeTransfer = functions.firestore.document('stripe_customers/{userId}/transfers/{id}').onCreate(async (snap, context) => {
const val = snap.data();
try {
// Look up the Stripe account id written in createStripeUser
const snapshot = await admin.firestore().collection(`stripe_customers`).doc(context.params.userId).get()
const snapval = snapshot.data();
const destinationAccount = val.destination
const amount = val.amount;
const charge = {amount, currency, destination: destinationAccount, transfer_group: val.transfer_group};
if (val.source !== null) {
charge.source = val.source;
}
const response = await stripe.transfers.create(charge);
stripe.paymentIntents.confirm(response.id, {payment_method: response.payment_method})
// If the result is successful, write it back to the database
return snap.ref.set(response, { merge: true });
} catch(error) {
// We want to capture errors and render them in a user-friendly way, while
// still logging an exception with StackDriver
console.log(error);
await snap.ref.set({error: userFacingMessage(error)}, { merge: true });
return reportError(error, {user: context.params.userId});
}
});
有人可以解释一下我在这里缺少什么吗?为什么我会收到错误消息?我尝试手动充值帐户,但也没有帮助。
更新 1:根据 Sergio Tulentsev 的评论,我似乎必须确认转移才能成功。因此,我在成功传输后执行了以下行,但错误仍然相同:
stripe.paymentIntents.confirm(response.id, {payment_method: response.payment_method})
stripe. paymentIntent.confirm
与 stripe.confirmCardPayment
有什么区别?
最佳答案
您似乎有权访问仪表板并且拥有测试帐户。在这种情况下,您可以从“付款”->“新建”手动添加资金,然后提供测试卡详细信息,如所附照片所示,此处使用的卡号为 4000 0000 0000 0077。
正如您提到的,您正在生成付款意图,只有在您添加了有效的真实账户后,才会将费用金额记入您的可用资金,直到那时资金将始终处于保留状态。
因此,为了进行测试,您可以手动添加资金,如链接pic of generating new payment manually所示
关于javascript - Stripe连接传输: Insufficient funds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59443719/
我正在尝试从我的谷歌驱动器下载电子表格。我正在关注 this reference并且在许可方面遇到问题。我从 https://www.googleapis.com/auth/drive.file 开始
我正在尝试使用以下命令将一个目录从我的虚拟机复制到我本地机器的桌面: gcloud compute scp --recurse instance-1:~/directory ~/Desktop/ 我尝
我正在尝试获取Youtube的评论,但它引发了此异常- {“Google.Apis.Requests.RequestError \ r \ n权限不足:请求的身份验证范围不足。[403] \ r \
我试图用 jmap 捕获 tomcat 进程转储,但是我得到错误“内存不足或附加权限不足”,显然有足够的内存,并且当前登录用户在角色本地管理员组中。如果我以管理员身份运行 cmd 命令,它仍然失败。
为了测试我们的应用程序,我需要插入/更新谷歌日历事件并验证边缘情况,比如 session 邀请是否超过 30 天,它不应该显示给最终用户。我正在为单个 gmail id testaccount@.co
我正在使用这个 endpoint : get_media(bucket=*, object=*, ifGenerationNotMatch=None, generation=None, ifMeta
我正在尝试将 Stripe 的 Connect 实现到我的应用程序中。我已经完成了数小时的研究和试错方法调试,现在我遇到的情况是没有出现技术错误,但出现错误: Insufficient funds i
我正在尝试在我的应用程序中使用静默推送通知,它似乎可以正常工作一两个小时,但在此期间之后将不会发送通知,并且我收到“高优先级推送:bundleID-资源不足”警告。任何人都知道可能是什么问题? 最佳答
我正在尝试使用以下命令添加以下条目: ldapadd -Y EXTERNAL -H ldapi:/// -f server5_ldap.ldif server5_ldap.ldif 的内容如下: #
我已完成描述的 Azure Cats&Dogs 教程 here我在 AKS 中启动应用程序的最后一步中遇到错误。 Kubernetes 报告我的 Pod 不足,但我不确定为什么会出现这种情况。几周前我
这是我在这里的第一个问题。 我一直想用流行的 IMDb 数据集创建一个数据集用于学习目的。目录如下: .../train/pos/和 .../train/neg/。我创建了一个函数,它将文本文件与其标
当我使用 gradle 构建时,它以信息失败: OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000788800000
我正在执行 https://hub.docker.com/r/apache/nifi 的“独立实例,双向 SSL”部分中的步骤。 .但是,当我访问 NiFi 页面时,我的用户权限不足。以下是我正在使用
我在向部署在我的 Google Cloud Kubernetes 集群中的 Spring Boot 应用程序发送请求时遇到困难。我的应用程序收到一张照片并将其发送到 Google Vision API
我开发了第一个 Firestore 应用程序并没有真正意识到我没有构建权限模型,事实上我后来用 bolt 固定了它。 (如果这是问题的根源,我愿意接受有关权限最佳实践和/或如何更好地实现权限规则的反馈
我在 Ubuntu 上遇到 Apache-Karaf 3.0.0 的问题我想用命令“start”启动一个包。但我收到以下错误: Error executing command: Insufficien
我在 Ubuntu 12.04 上新部署服务器程序“MyServer”时遇到问题。该程序在第一台机器上运行良好。 但是在新机器上,MyServer程序在mysql_init()期间返回异常:“内存不足
所以我刚开始用 CUDA 编写,遵循 An Even Easier Introduction to CUDA指导。到目前为止,一切都很好。然后我想实现一个神经网络,这让我对函数 cudaMallocM
我正在用 c++ 风格的 opencv 2.3 开发一个项目。 在应用程序中,我加载视频并处理每一帧,并对 Mat 对象做一些事情。一段时间后,我收到内存不足错误。 我像这样捕捉帧: FCapture
我正在使用 web3.js v1.0.0-beta.34 和 nodeJS v9.11.2 在 Kovan 测试网上执行智能合约。同样的方法适用于我在 Ropsten 上使用另一个智能合约。这是我通过
我是一名优秀的程序员,十分优秀!