PHP code example of symm / guzzle-bitpay

1. Go to this page and download the library: Download symm/guzzle-bitpay 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/ */

    

symm / guzzle-bitpay example snippets


use Symm\BitpayClient\BitpayClient;

$client = BitpayClient::createTestClient('YOUR_TEST_API_KEY_HERE');
 php
$invoice = $client->createInvoice(
    array(
        'price'    => 5,
        'currency' => 'GBP',
    )
);

print $invoice->getUrl() . PHP_EOL;
 php
$invoice = $client->getInvoice(
    array(
        'id' => 'YOUR_INVOICE_ID_HERE'
    )
);

print $invoice->getStatus() . PHP_EOL;
 php
$invoice = $client->verifyNotification(file_get_contents("php://input"));
 php
$currencyCollection = $client->getRates();
foreach ($currencyCollection as $currency) {
    /** @var \Symm\BitpayClient\Model\Currency $currency */
    print $currency->getCode() . ': ' . $currency->getRate();
}