【问题标题】:Balanced Payments API call.meteor.js平衡支付 API call.meteor.js
【发布时间】:2013-09-27 14:06:35
【问题描述】:

您好,我目前在我的流星应用程序中使用平衡支付。我可以很好地创建卡片和客户,并且可以很好地将卡片与客户相关联。但是,当我尝试创建借记卡时遇到了问题。这是我编写的代码,几乎直接取自平衡文档。

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"
}

我看到 URI 包含市场和客户 url,但我不知道为什么或什么可能导致这种情况发生,因为就像我说的那样,客户创建、卡创建和卡关联调用都可以正常工作。

任何建议将不胜感激。

【问题讨论】:

    标签: node.js meteor balanced-payments


    【解决方案1】:

    https://docs.balancedpayments.com/current/api#create-a-new-debit 上的平衡 api 文档表明请求的 URL 存在问题。

    您正在使用的 api 模块中的 URL 请求

    /v1/marketplaces/TEST-MPFj4MYWjZc9xt2IjTIni7/v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits
    

    应该是什么时候

    /v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits
    

    也可能是它需要 marketplaces uri,但文档中没有与这种模式匹配的规范,加上 '/v1/` 表明它被不必要地附加了

    您尚未提供有关您正在使用的包类型的详细信息,但问题在于创建请求 URI 的部分中的包,或者如果它未在您设置的参数之一中验证提供。

    【讨论】:

    • 我正在使用的包可以在这里看到github.com/ianserlin/meteor-balanced-payments,它是由同一个人编写的包的一个端口,可以在这里看到github.com/ianserlin/nbalanced
    • 您能在运行.Create 之前检查一下customerContext.Debits._action_uricustomerContext.Debits._account_uri 的结果吗?它是否具有单个值或类似于目录路径?发生这种情况时,您是否同时运行了很多这些?
    • customorContext.Debits._account_uri 未定义,customorContext.Debit._action_uri 得到 /v1/customers/CU6jgv9FlavhPyYQ6ObZKDny/debits。不,我一次只在我的生产服务器上运行其中一个。也感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多