【问题标题】:NotFound at field "card_nonce" errorNotFound 在字段“card_nonce”错误
【发布时间】:2018-08-10 00:29:07
【问题描述】:

我在测试/沙盒中收到此错误,但在生产中没有

InvalidRequestError - 字段“card_nonce”未找到:找不到资源。

我通过了,看:

请让我知道我需要做什么。

【问题讨论】:

    标签: square-connect


    【解决方案1】:

    在测试 Square 时

    • 使用沙盒/测试应用程序 ID
    • 您不能使用生产访问密钥 - 并且您不能生成访问密钥(用于测试)
    • 您必须在沙盒访问密钥中进行硬编码 - 这样您的所有测试站点都使用相同的密钥

    这将解决上述问题。

    【讨论】:

    • 我收到错误消息。 CreateCustomerCardRequest createCustomerCardRequest = new CreateCustomerCardRequest("sq0idp-HHRL8jUWmdUV7OsUhczXEw", billingAddress, "Demo Visa");
    • 错误是{"errors":[{"category":"INVALID_REQUEST_ERROR","code":"NOT_FOUND","detail":"Resource not found.","field":"card_nonce"}]}
    【解决方案2】:

    您能否检查用于沙盒卡随机数创建的 App ID 是否与您用于沙盒 Charge 请求的匹配?沙盒应用 ID 应具有 sandbox- 前缀。

    【讨论】:

    • 我已经添加了我的沙盒应用程序 ID,但问题仍然存在 Resource not found public 'category' => string 'INVALID_REQUEST_ERROR' (length=21) public 'code' => string 'NOT_FOUND' (length=9) public 'detail' => string 'Resource not found.' (length=19)public 'field' => string 'card_nonce' (length=10)
    • 我在本地测试它是否需要将它移动到服务器上进行测试?
    【解决方案3】:

    我认为这里的问题是card_nonce 属性。此属性必须从SqPaymentForm 生成,因为documentation 表示:

    从 SqPaymentForm 生成的 nonce 代表卡 收费。向该端点提供随机数的应用程序必须是 使用 SqPaymentForm 生成随机数的同一应用程序。 否则,nonce 无效。

    所以我建议使用 Square 建议的test cases,然后添加到您的平台。

    【讨论】:

      猜你喜欢
      • 2016-12-16
      • 2021-09-08
      • 2018-03-16
      • 2017-06-25
      • 2023-03-20
      • 2020-10-08
      相关资源
      最近更新 更多