In the above screen shot of a Coinbase.com account Merchant Settings page you will notice the field that allows you to enter a Callback URL so that you may receive instant payment notifications when you receive an order or bitcoin payment via the Coinbase payment button on your website. These can be useful to mark an order or user as “paid” once you’ve received a payment. Coinbase Callbacks send an automated message to the URL that you specify in the “Callback URL” field in the Merchant Settings in your Coinbase.com account. Callbacks are always POST requests in JSON format to a callback URL that you set in the above example it is http://www.yoursite.com/coin.php.
Below is an example of the JSON Order Callback that is sent to coin.php.
Below is the code for coin.php that processes the Coinbase Callback. It decodes the Callback input and inserts the parameters into a MySQL database that you specify. It also sends you an email notifying you of the transaction. Note that coin.php returns an integer code of 200, this is what the Coinbase expects to receive in order to acknowledge that the callback was successful.