【问题标题】:HTML cannot retrieve Payment Button created in Coinbase Sandbox environmentHTML 无法检索在 Coinbase 沙盒环境中创建的支付按钮
【发布时间】:2015-06-15 03:43:17
【问题描述】:

这里是 Coinbase 新手。
在沙盒环境中测试 Coinbase,无法让支付按钮显示在 HTML 页面中。追踪到 button.js 试图从 www<dot> 而不是 sandbox<dot> 检索支付按钮代码。

这是场景:

  1. 使用“沙盒”环境。
  2. 通过对https://api.sandbox.coinbase.com/v1/buttons 的 API 调用生成按钮代码 所有 API 安全/身份验证工作正常。

  3. 使用 2. 中生成的 [button-code] 直接在浏览器中输入https://sandbox.coinbase.com/checkouts/[button-code] 测试结帐屏幕。 结果:浏览器显示我的商家帐户的结帐屏幕。酷。

  4. 使用2中生成的[button-code]。直接在浏览器中输入https://sandbox.coinbase.com/buttons/[button-code]来测试按钮。结果:浏览器显示一个漂亮的按钮。又凉了。

  5. 将此代码放在 HTML 页面中:

    <a class="coinbase-button" data-code="[button-code]"  href="https://sandbox.coinbase.com/checkouts/[button-code]">Donate Bitcoins </a>
     <script src="https://sandbox.coinbase.com/assets/button.js" type="text/javascript"></script>
    

在浏览器屏幕上会发生这种情况:它会短暂显示“捐赠比特币”链接,然后将链接替换为文本“无效的数据代码属性 (1)”

监控 HTTP 流量我看到错误来自后台调用以检索按钮,它转到:https://www.coinbase.com/buttons/[button-code] --- 它应该转到sandbox&lt;dot&gt;,如上面的第 4 步,而不是 @ 987654329@

源 sandbox.coinbase.com/assets/button.js 已硬编码 www.coinbase.com。这是错误的,虽然我不敢相信我是第一个遇到这个问题的人,所以我承认我可能做错了什么。

Coinbase 会修复 Sandbox 环境中的 button.js 代码吗?

【问题讨论】:

    标签: sandbox coinbase-api


    【解决方案1】:

    此答案来自 coinbase 论坛 (source) 上此问题的副本

    诀窍是在按钮div上设置data-env="Sandbox",脚本会正确调整域。

    &lt;div class="coinbase-button" data-env="sandbox" data-code="xxxx"&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-10
      • 2015-03-08
      • 1970-01-01
      • 1970-01-01
      • 2012-08-06
      • 2016-02-15
      • 1970-01-01
      • 2016-06-23
      相关资源
      最近更新 更多