PHP code example of peterfox / bitpayclient

1. Go to this page and download the library: Download peterfox/bitpayclient library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

peterfox / bitpayclient example snippets


$client = new BitPayClient('YOUR-API-KEY');

$invoiceResponse = $client->createInvoice(0.0001, 'BTC');

$client = new BitPayClient('YOUR-API-KEY');

$invoiceResponse = $client->createInvoice(0.0001, 'BTC', ['redirectUrl' => 'http://somewhere']);

$client = new BitPayClient('YOUR-API-KEY');

$invoiceResponse = $client->createInvoice(0.0001, 'BTC', ['posData' => ['some_id' => 100]]);

$client = new BitPayClient('YOUR-API-KEY');

$invoiceData = [
            'id'=> 'CNRWBUPUZs9foP2ysZBBc',
            'url'=> 'https://bitpay.com/invoice?CNRWBUPUZs9foP2ysZBBc',
            'status' => 'new',
            'btcPrice' => '0.0001',
            'price' => 0.0001,
            'currency' => 'BTC',
            'invoiceTime' => 1391301679184,
            'expirationTime' => 1391302579184,
            'currentTime' => 1391302121888
            ];

$invoiceResponse = $client->getInvoiceFromArray($invoiceData);

$client = new BitPayClient('YOUR-API-KEY');

$invoiceGetResponse = $client->getInvoice('CNRWBUPUZs9foP2ysZBBc');