【问题标题】:Receive JSON Callback?接收 JSON 回调?
【发布时间】:2013-07-26 03:01:26
【问题描述】:

我正在尝试使用 Coinbase 的 API (https://coinbase.com/api/doc) 在比特币付款后接收对我网站的回调。但是我不确定如何将接收到的 JSON 回调放在一个变量中,以便我可以使用回调的信息。

Coinbase 的示例回调是:

{
"order": {
    "id": "5RTQNACF",
    "created_at": "2012-12-09T21:23:41-08:00",
    "status": "completed",
    "total_btc": {
        "cents": 100000000,
        "currency_iso": "BTC"
    },
    "total_native": {
        "cents": 1253,
        "currency_iso": "USD"
    },
    "custom": "order1234",
    "receive_address": "1NhwPYPgoPwr5hynRAsto5ZgEcw1LzM3My",
    "button": {
        "type": "buy_now",
        "name": "Alpaca Socks",
        "description": "The ultimate in lightweight footwear",
        "id": "5d37a3b61914d6d0ad15b5135d80c19f"
    },
    "transaction": {
        "id": "514f18b7a5ea3d630a00000f",
        "hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
        "confirmations": 0
    }
}
}

我尝试过使用

$json = $_POST["order"]

检索它但它不起作用。

【问题讨论】:

    标签: json api callback payment bitcoin


    【解决方案1】:

    尝试使用

    $get = file_get_contents("php://input");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-07
      • 2017-01-06
      • 2014-07-31
      • 1970-01-01
      • 2014-05-20
      • 2016-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多