• UTC
  • :
  • :

BTCz/BTC: 0.00000023 BTCz/USD: 0.00165404

Eng flag English

Get instant easy payments with BTCz

  - Create instant payment gateways
  - No registration necessary
  - No additional fees
  - Automatic transactions

Create Payment Gateway * required

API Info

You can use our API to accept BTCz payments on your website and verify the transaction.


Creating a gateway

  • Function: create
  • Method: GET/POST
  • Parameters:
    • f*: create
    • p_addr*: Your BTCz address where the payment will go.
    • p_email*: Your email address.
    • p_pingback: The pingback URL (optional)
    • p_invoicename: Custom invoice name or ID (alpha-numeric-dash 64char limited) (optional)
    • p_amount*: 25-1000000 BTCz/p_currency_code
      • p_currency_code: 3 letter currency code, leave undefined for BTCZ, list of supported here.
    • p_expire*: 15-60 Minutes
    • p_secret: Custom alphanumeric secret (8-32 char) (if set we will not generate a secret)
    • p_success_url: URL to redirect to after the invoice has finished
    • p_skipContinue: If set, the invoice timer will start immediately after creation

  • URL:
    https://btcz.in/api/process
  • GET Example:
    https://btcz.in/api/process?f=create&p_addr=t1WJsHqiJpSN4MzWZGVurfiovVQWMqQ8tJs&p_pingback=https://myserver.com/pingback.php&p_amount_[email protected]example.com
    
    Expanded:
    https://btcz.in/api/process?
    	f=create&
    	p_addr=t1WJsHqiJpSN4MzWZGVurfiovVQWMqQ8tJs&
    	p_pingback=https://myserver.com/pingback.php&
    	p_amount_usd=25&
    	p_invoicename=BTCzInvoice001&
    	p_expire=30&
    	[email protected]
  • PHP cURL POST Example:
    function CreateGateway($InvoiceID,$Amount,$CurrencyCode,$Expire)
    {
    	$APIUrl = 'https://btcz.in/api/process';
    	
    	$MerchantAddress = "t1WJsHqiJpSN4MzWZGVurfiovVQWMqQ8tJs";
    	$PingbackUrl = "https://myserver.com/pingback.php";
    	$MerchantEmail = "[email protected]";
    	
    	$fields = array(
    		'f' => "create",
    		'p_addr' => urlencode($MerchantAddress),
    		'p_pingback' => urlencode($PingbackUrl),
    		'p_invoicename' => urlencode($InvoiceID),
    		'p_amount' => urlencode($Amount),
    		'p_currency_code' => urlencode($CurrencyCode),		
    		'p_email' => urlencode($MerchantEmail),
    		'p_expire' => urlencode($Expire)
    	);
    	
    	$fields_string = "";
    	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    	rtrim($fields_string, '&');
    
    	$ch = curl_init();
    	curl_setopt($ch,CURLOPT_URL, $APIUrl);
    	curl_setopt($ch,CURLOPT_POST, count($fields));
    	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
    		
    	$result = curl_exec($ch);
    	$response = curl_getinfo( $ch );
    	curl_close($ch);
    	
    	if($response['http_code'] != 200)
    		return false;
    	
    	return $result;
    }
    
    $RESP =  CreateGateway("Invoice001", 23.53, "USD", 20);
    $JSON_RESP = json_decode($RESP);
    
    if(!empty($JSON_RESP))
    {
    	print_r($JSON_RESP);
    	$InvoiceURL = "https://btcz.in/invoice?id=".$JSON_RESP->url_id;
    	$Secret = $JSON_RESP->secret;
    }
    else if(strlen($RESP))
    {
    	echo $RESP; //Printable error
    }
    else
    {
    	echo "No response from API"; //Unknown error
    }
    
    
  • Sample Response:
    {
        "url_id": "fc56aebd2e86acba647e11d34fddc3ad",
        "timestamp_start": "1518389427",
        "timestamp_end": "1518391227",
        "secret": "5aa7199d448b0ecc6558346a657be280",
        "currentTime": 1518389427
    }
  • Invoice URL Example:
    https://btcz.in/invoice?id=fc56aebd2e86acba647e11d34fddc3ad

Fetching Data from Existing Gateway

  • Function: getinfo
  • Method: GET/POST
  • Parameters:
    • f*: getinfo
    • id*: The URL generated by create
    • p_secret: Optional secret to verify UID is correct
  • URL:
    https://btcz.in/api/process
  • GET Example:
    https://btcz.in/api/process?f=getinfo&id=fc56aebd2e86acba647e11d34fddc3ad
  • Sample Response:
    {
        "url_id": "7de490eb349fbb5a0e4f54bee0df58be",
        "amount_needed": "5",
        "amount_received": "0",
        "generated": "t1VqToPjF4HuuWsou8V2fgiEF2vY8gsd56j",
        "state": "1",
        "tx_right": "",
        "timestamp_start": "1518485608",
        "timestamp_end": "1518489208",
        "timestamp_initiated": "1518485616",
        "confirmations": "1",
        "timeComplete": "",
        "currentTime": 1518485815
    }

Pingback Information

  • - A pingback is sent when invoice has expired, or completed with payments.
  • - Use this data to verify transactions

  • JSON Variable: data
  • Method: POST
  • Sample Success:
    {
        "url_id": "a86a5a6a48e2d81ddb15d0654eaef4fb",
        "receiver": "t1Kw4YnXkYMCMDf2MAfUKfwzmV7sgwzMZjE",
        "generated": "t1L4eJBNvRr3h4i6L969zDCZhgg2Mfc6hEf",
        "timestamp_start": "1518501770",
        "timestamp_end": "1518505370",
        "state": "5",
        "invoicename": "my payment LTD",
        "amount_needed": "26",
        "amount_received": "26",
        "payorEmail": "[email protected]",
        "timestamp_initiated": "1518501779",
        "timeComplete": "1518502201",
        "secret": "a99d55c462d1eeaf9385439417e03f72",
        "lasttx": "eaf93c580219749fe33b34018920a86fdba6bc9a9d9a80ce0c7e5b1e5ff12def",
        "strState": "Payment complete",
        "payor_tx": {
            "1": "61a3db8a6f400d4f88715a789bfa1f9ac8776f04aeb068e8e7d73de75ef286ca"
        }
    }
    				
  • Sample Expired:
    {
        "url_id": "3e86d96c00491f24be34850dd58efa74",
        "receiver": "t1WJsHqiJpSN4MzWZGVurfiovVQWMqQ8tJs",
        "generated": "",
        "timestamp_start": "1518495654",
        "timestamp_end": "1518496554",
        "state": "2",
        "invoicename": "my payment LTD",
        "amount_needed": "123",
        "amount_received": "0",
        "payorEmail": "",
        "timestamp_initiated": "",
        "timeComplete": "",
        "secret": "7be5fc6f72f36d8434d06be7a18aed54",
        "lasttx": "",
        "strState": "Gateway expired",
        "payor_tx": []
    }
  • Sample Pingback.php:
    if(!isset($_POST["data"]))
    	die();
    
    $data = json_decode($_POST["data"]);
    
    function ProcessPingback($data, $secret)
    {
    	if($data->secret != $secret) //unknown secret
    		return false;
    	
    	if($data->state == 2) //expired
    	{
    		//do stuff
    	}
    	else if($data->state == 5) //success
    	{		
    		//do stuff
    	}	
    }

Other Information

  • States explained (you will only receive a pingback with states 2 and 5):
    • 0: Awaiting payor to continue
    • 1: Awaiting payment
    • 2: Gateway expired
    • 3: Partially paid
    • 4: Invoice completed
    • 5: Payment & Pingback completed
  • Standard tx fee: 0.0001
  • TX confirmation count: 2
  • If a transaction is stuck unverified, we will add 30 seconds to the invoice every minute.
  • An email is sent after: 5 failed pingbacks.
  • Payment address is generated after payor continues.
  • Gateways are limited to 10 active (state 0,1,3) per IP, please contact us if you require more.


This is a free service, please support us by donating

[BTCz.in] BTCz: t1NKmPAu8qSkb2L1wM7BnzmqyuovMEKZVZg
[Community] BTCz: t1fHHnAXxoPWGY77sG5Zw2sFfGUTpW6BcSZ

Contact us

arrow_upward