Node.js 平衡支付API call.meteor.js
嗨,我目前在我的meteor应用程序中使用平衡支付。我可以很好地创建卡片和客户,我可以很好地将卡片与客户关联。不过,当我尝试创建借项时,遇到了一个问题。下面是我编写的代码,它几乎直接取自平衡文档Node.js 平衡支付API call.meteor.js,node.js,meteor,balanced-payments,Node.js,Meteor,Balanced Payments,嗨,我目前在我的meteor应用程序中使用平衡支付。我可以很好地创建卡片和客户,我可以很好地将卡片与客户关联。不过,当我尝试创建借项时,遇到了一个问题。下面是我编写的代码,它几乎直接取自平衡文档 var customer = balanced.Customers.get(user.customer.uri, function (err, customer) { console.error(err); console.log(customer); var cu
var customer = balanced.Customers.get(user.customer.uri, function (err, customer) {
console.error(err);
console.log(customer);
var customerContext = balanced.Customers.nbalanced(customer);
var debitInfo = {
amount: amount,
appears_on_statement_as: "Statement text",
description: "Some descriptive text for the debit in the dashboard"
};
customerContext.Debits.create(debitInfo, function(err, result) {
console.error(err);
console.log(result);
});
});
每当上述代码运行时,我都会收到错误“在服务器上找不到请求的URL”。我发现了问题,但我不完全确定如何解决它。我去平衡仪表板查看日志,我发现了这个
Date: Fri, 27 Sep 2013, 6:46 AM
Method: POST
URI: /v1/marketplaces/TEST-MPFj4MYWjZc9xt2IjTIni7/v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits
Status: 404 NOT FOUND
请求机构在这里:
{
"appears_on_statement_as": "Statement text",
"amount": 1200,
"description": "Some descriptive text for the debit in the dashboard"
}
以下是回应机构:
{
"status": "Not Found",
"category_code": "not-found",
"description": "<p>The requested URL was not found on the server.</p><p>If you entered the URL manually please check your spelling and try again.</p> Your request id is OHM38291020277b11e38b38026ba7cac9da.",
"status_code": 404,
"category_type": "request",
"_uris": {},
"request_id": "OHM38291020277b11e38b38026ba7cac9da"
}
{
“状态”:“未找到”,
“类别代码”:“未找到”,
“说明”:“在服务器上找不到请求的URL。如果您手动输入URL,请检查拼写并重试。您的请求id是OHM38291020277b11e38b38026ba7cac9da。”,
“状态代码”:404,
“类别类型”:“请求”,
“_uris”:{},
“请求id”:“OHM38291020277b11e38b38026ba7cac9da”
}
我看到URI中有市场和客户url,但我不知道为什么或者是什么导致了这种情况,因为正如我所说的,客户创建、卡片创建和卡片关联调用都可以完美地工作
任何建议都将不胜感激。at上的平衡api文档表明请求的URL存在问题 正在使用请求的api模块中的URL
/v1/marketplaces/TEST-MPFj4MYWjZc9xt2IjTIni7/v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits
应该是什么时候
/v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits
它也可能需要marketplaces
uri,但是文档中没有与这种模式匹配的规范,加上“/v1/”表示不必要地附加了它
您尚未给出所使用的包类型的详细信息,但问题在于创建请求URI部分中的包,或者如果它没有在您提供的一个参数中进行验证。我正在使用的包可以在这里看到,它是由同一个人编写的包的一个端口,可以在这里看到。您能检查一下您刚才得到的
customerContext.debitis.\u action\u uri
和customerContext.debitis.\u account\u uri
吗是否运行。是否创建?它是否有一个值或类似于目录路径?当这种情况发生时,您是否同时运行了很多这些功能?我没有定义customerContext.debitis.\u account\u uri,我得到/v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debitis for customorContext.Debit.\u action\u uri。不,我在生产服务器上一次只运行其中一个。也谢谢你的帮助。