Advertisement
coinables

Blockchain Receive Payments API v2 HD BIP32 xpub

Nov 27th, 2015
2,310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. //set parameters
  2.     $api_key = "your_blockchain_api_Key";
  3.     $xpub = "xpubYour_extended_public_key";
  4.     $secret = "your_secret"; //this can be anything you want
  5.     $rootURL = "http://yourrooturl.com/directory"; //example https://mysite.org  or http://yourhomepage.com/store
  6.     $orderID = uniqid();
  7.  
  8. //call blockchain info receive payments API
  9.     $callback_url = $rootURL."/callback.php?invoice=".$orderID."&secret=".$secret;
  10.     $receive_url = "https://api.blockchain.info/v2/receive?key=".$api_key."&xpub=".$xpub."&callback=".urlencode($callback_url);
  11.     $ch = curl_init();
  12.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  13.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14.     curl_setopt($ch, CURLOPT_URL, $receive_url);
  15.     $ccc = curl_exec($ch);
  16.     $json = json_decode($ccc, true);
  17.     $payTo = $json['address'];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement