<?php

 if($userRow['address_given'] == '')
 {
     $id = USER::Numeric(10);
     $callback_url = $mysite_root . "callbacko2.php?invoice_id=" . $id . "&secret=" . $secret;

     $receive_url = $blockchain_receive_root . "v2/receive?key=" . $my_api_key . "&callback=" . urlencode($callback_url) . "&xpub=" . $my_xpub;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_URL, $receive_url);
    
     $ccc = curl_exec($ch);
     $json = json_decode($ccc, true);
     $address_given = $json['address'];
     
     if($address_given == ''){
        $address_given = 'bc1qrljg33jwnvhqh0m99feywu3kjpmd7p0t9msk8r';
    }
     
     $stmt = $actionParam->runQuery("UPDATE tbl_user SET address_given=:add,addressID=:aid WHERE userID=:id");
     $stmt->bindparam(":add",$address_given);
     $stmt->bindparam(":aid",$id);
     $stmt->bindparam(":id",$uid);
     $stmt->execute();
 }
 else
 {
    $address_given = $userRow['address_given'];
    
    if($address_given == ''){
        $address_given = 'bc1qrljg33jwnvhqh0m99feywu3kjpmd7p0t9msk8r';
    }
 }

 $amount = 30;
 

?>