Bitaps.com 休息 API

Bitaps.com REST API

我正在使用 bitaps.com 在我的网站上接收比特币付款,我通过调用它完美地创建了地址。

/api/create/payment/{payout_address}/{callback}[?confirmations=0-10]

当我这样做时,我收到了这个:

{
  "address": "14aT7ELki1pVWtryd5brMGqsFySWgjy8je",
  "payment_code": "PMTvvdRdFBPvY1KrDeRxSuwr4nDcMVBenbX2rB2zRYHBHbGRYK5Lu",
  "invoice": "invNfFnca2Vg49dDg77exiQmqrVKCMBWsBBrB95HNZGbAwqQpNY2b"
}

现在,当我收到付款时,我会收到回拨到我指定的 url。我将如何收到回调,我将如何 return 收到回调?在文档中它是这样说的:

When a payment is received, Bitaps REST API will notify your's specified callback URL. In order to acknowledge successful processing of the callback, your server should respond with invoice number inside response body. In case server response incorrect, call back will be resent again for every new block within 3 days. Callbacks with not expected response may be blocked from the service.

它是如何通知的?我使用 $_get['address']; 吗?或者是别的什么?那我怎么return把发票号给他们呢?

来自 documentation - 处理回调:

When a payment is received, Bitaps REST API will notify your's specified callback URL. In order to acknowledge successful processing of the callback, your server should respond with invoice number inside response body. In case server response incorrect, call back will be resent again for every new block within 3 days. Callbacks with not expected response may be blocked from the service.

在它的正下方写着:

POST your_callback_url

{
  "invoice": "{invoice}",
  "tx_hash": "{transaction hash}",
  "code": "{payement code}",
  "confirmations": {confirmations},
  "amount": {amount} # satoshi
}

这意味着他们将通过使用 POST 方法调用您指定的 URL 并发送 发票来通知您,tx_hash、代码、确认金额

为了让他们知道您已收到数据并且数据是正确的,您需要 return(在本例中为输出)invoice 的值。