<p>The callback lets you know the payment has been recieved. The confirmations are also included in the callback</p>

<blockquote>
  <p>When a payment is received blockchain.info will notify the callback
  URL passed using the create method. The parameters will be supplied in
  a http GET request. The callback url is limited to 255 characters in
  length.</p>
  
  <p>Parameters</p>
  
  <ul>
  <li><strong>value</strong> The value of the payment received in satoshi. Divide by    100000000 to get the value in BTC. </li>
  <li><strong>input_address</strong> The bitcoin address that received the transaction.</li>
  <li><strong>confirmations</strong> The number of confirmations of this transaction.</li>
  <li><strong>{Custom Parameters}</strong> Any parameters included in the callback URL will be passed back to the callback URL in the notification.</li>
  <li><strong>transaction_hash</strong> The transaction hash.</li>
  <li><strong>input_transaction_hash</strong> The original paying in hash before forwarding.</li>
  <li><strong>destination_address</strong> The destination bitcoin address. Check this matches your address.</li>
  </ul>
  
  <p>A double spend occurs when a malicious user spends the same BTC twice.
  A payment that initial appears successful could be reversed at a later
  date. This is counteracted by waiting for the transaction to be
  included in the blockchain and reaching a number of confirmations. 6
  confirmations is generally considered safe for high value
  transactions.</p>
  
  <p>Validate the transaction confirmations in the callback script by
  checking $_GET['confirmations'] parameter. It is recommended you
  acknowledge the transaction at zero confirmations but only trust the
  transaction after one confirmation. For example, if purchasing a
  product, we would show the order as successful at zero confirmations,
  but only ship the product when 6 or more confirmations are reached.
  See the PHP demo callback.php for an example. </p>
</blockquote>

<p>sourced from: <a href="https://blockchain.info/api/api_receive" rel="nofollow">https://blockchain.info/api/api_receive</a></p>

CC BY-SA 3.0
2015-11-02T14:52:13.063Z
2015-11-02T14:52:13.063Z
Charles S
<p>Alright, after some thinking, I finally understood how will I use the callback. Blockchain's API will only send a callback <strong>if</strong> <code>there has been a transaction</code>. What you need to track here is, that the amount the user sends should be equal to what you've requested. </p>

<p>Let's take a scenario:</p>

<ol>
<li><p>I sell an online product worth $5 and use blockchain’s payment receiving API to receive the money.</p></li>
<li><p>The user sends an amount less than $5 (suppose $0.05), we then get a callback and assume that the transaction was successful. However, the user paid less amount that he requested. Therefore, we need to keep track of the amount and verify it with the original amount. If both the amount matches, then only you should proceed further.</p></li>
</ol>

CC BY-SA 3.0
2015-11-02T16:30:53.947Z
2015-11-10T02:45:25.717Z
2015-11-10T02:45:25.717Z
Akshay
<p>I'm trying to accept bitcoin payments on my website using blockchain.info's API. However, I'm confused with their callback.</p>

<p>I've read through their callback, but how would I know if the transaction was successful or not ?</p>

<api><blockchain.info>
Callbacks using blockchain.info's API
Akshay
# Callbacks using blockchain.info's API

(Asked by: username_0 on 2015-11-02)

I'm trying to accept bitcoin payments on my website using blockchain.info's API. However, I'm confused with their callback.

I've read through their callback, but how would I know if the transaction was successful or not ?

**Tags:** api, blockchain.info


---

## 2 answers

### Answer by username_1 on 2015-11-02. Score: 2 | Accepted answer

The callback lets you know the payment has been recieved. The confirmations are also included in the callback

> When a payment is received blockchain.info will notify the callback
> URL passed using the create method. The parameters will be supplied in
> a http GET request. The callback url is limited to 255 characters in
> length.
>
> Parameters
>
> * **value** The value of the payment received in satoshi. Divide by 100000000 to get the value in BTC.
> * **input\_address** The bitcoin address that received the transaction.
> * **confirmations** The number of confirmations of this transaction.
> * **{Custom Parameters}** Any parameters included in the callback URL will be passed back to the callback URL in the notification.
> * **transaction\_hash** The transaction hash.
> * **input\_transaction\_hash** The original paying in hash before forwarding.
> * **destination\_address** The destination bitcoin address. Check this matches your address.
>
> A double spend occurs when a malicious user spends the same BTC twice.
> A payment that initial appears successful could be reversed at a later
> date. This is counteracted by waiting for the transaction to be
> included in the blockchain and reaching a number of confirmations. 6
> confirmations is generally considered safe for high value
> transactions.
>
> Validate the transaction confirmations in the callback script by
> checking $\_GET['confirmations'] parameter. It is recommended you
> acknowledge the transaction at zero confirmations but only trust the
> transaction after one confirmation. For example, if purchasing a
> product, we would show the order as successful at zero confirmations,
> but only ship the product when 6 or more confirmations are reached.
> See the PHP demo callback.php for an example.

sourced from: <https://blockchain.info/api/api_receive>


---

### Answer by username_0 on 2015-11-02. Score: 1

Alright, after some thinking, I finally understood how will I use the callback. Blockchain's API will only send a callback **if** `there has been a transaction`. What you need to track here is, that the amount the user sends should be equal to what you've requested.

Let's take a scenario:

1. I sell an online product worth $5 and use blockchain’s payment receiving API to receive the money.
2. The user sends an amount less than $5 (suppose $0.05), we then get a callback and assume that the transaction was successful. However, the user paid less amount that he requested. Therefore, we need to keep track of the amount and verify it with the original amount. If both the amount matches, then only you should proceed further.


---

