PHP code example of sescandell / bitpay-client

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

    

sescandell / bitpay-client example snippets






ay = new BitPay\BitPay(
  new BitPay\Request\Curl,
  new BitPay\Encrypter\Hash('API-KEY'),
  'API-KEY',
  $options // array, optional
);

$invoice = $bitPay->createInvoice($orderID, $price); // returns Invoice Object

class stdClass#5 (10) {
  public $id =>
  string(10) "EXAMPLE-ID"
  public $url =>
  string(40) "https://bitpay.com/invoice?id=EXAMPLE-ID"
  public $posData =>
  string(67) "{"posData":[],"hash":"HASH"}"
  public $status =>
  string(3) "new"
  public $btcPrice =>
  string(6) "1.0000"
  public $price =>
  int(1)
  public $currency =>
  string(3) "BTC"
  public $invoiceTime =>
  int(1386958726781)
  public $expirationTime =>
  int(1386959626781)
  public $currentTime =>
  int(1386958726861)
}



ay = new BitPay\BitPay(
  new BitPay\Request\Curl,
  new BitPay\Encrypter\Hash('API-KEY'),
  'API-KEY',
  $options // array, optional
);

$invoice = $bitPay->createInvoice($orderID); // returns Invoice Object
bash
# Install Composer
$ curl -sS https://getcomposer.org/installer | php

# Add BitPay as a dependency
$ php composer.phar