gpt4 book ai didi

javascript - Stripe javascript API Stripe.Recipients 未定义

转载 作者:行者123 更新时间:2023-11-28 00:22:45 25 4
gpt4 key购买 nike

所以我使用 Parse 来处理支持 Stripe 的应用程序。我们希望我们的用户能够兑现他们的应用积分,我们计划使用 Stripe 来处理这个问题。我已经能够在 Stripe 中成功创建客户,并将银行帐户链接到这些客户。现在我正尝试向这些银行帐户之一发起转账,如下

https://stripe.com/docs/tutorials/sending-transfers

但是我遇到了 Stripe.recipients 未定义的问题。

相关代码:

Stripe 的初始化:

var Stripe = require('stripe');
Stripe.initialize('sk_test_ukk7e8B46I39nxoUd6XILpPZ');

解析云函数进行传输:

  Parse.Cloud.define("startTransfer", function(request, response) {
var userObjectId = request.params.userObjectId;
var credits = request.params.credits;
var StripeCustomer = Parse.Object.extend("StripeCustomer");
var stripeCustomerQuery = new Parse.Query(StripeCustomer);

stripeCustomerQuery.equalTo("userObj", userObjectId);
stripeCustomerQuery.find({
success: function(results) {
if(results.length == 0) {

} else if(results.length == 1) {
var customer = results[0];
// handle returning customer adding a new card
Stripe.Recipients.create({
name: customer.description,
type: "individual",
bank_account: customer.source,
email: customer.email
}, function(err, recipient) {
// recipient;
console.log("have a recipient");
if(err == nil) {
Stripe.transfers.create({
amount: credits,
currency: "usd",
recipient: recipient,
bank_account: customer.source,
statement_descriptor: "Cash Out"
}, function(err1, transfer) {
// asynchronously called
if(err == nil) {
response.success("Successfully transferred funds");
} else {
response.error(err1);
}
});
} else {
response.error(err);
}
});
}
}, error: function(error) {
reponse.error(error);
}
});
});

我使用 PFCloud.callFunction API 调用从 iOS 调用此函数。似乎正确地命中了此代码,但据说错误消息中的收件人未定义,但 Stripe 文档需要它。我该如何解决这个问题?

最佳答案

事实证明,Stripe 云代码模块确实使用的是旧版本的 Stripe。因此,根据这个错误报告,解决方案是下载较新的SDK并手动将其添加到云代码模块中。

来源:

https://developers.facebook.com/bugs/523104684492016/

错误报告的实际帖子(来自 Facebook 员工):

Parse modules are using an old version of the API and there is no plan to update it in the near future.

As a workaround please download the newer SDKs directly off the third party site, place it in "cloud/" folder and import it using require();

We're going to close this by design.

关于javascript - Stripe javascript API Stripe.Recipients 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29832891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com