php-bitpay-client/examples/GetTokens.php
BitWasp 04952ba29e Add classes for Payouts, Payout Instructions, and Payout Instruction Transactions.
Added methods to GET tokens, GET payouts, GET payout/:id, DELETE payout/:id
Tweaked request interface to contain DELETE method constant.
Added tests for most functions, more to follow
2014-10-27 06:11:59 +00:00

36 lines
1.1 KiB
PHP

<?php
/**
* WARNING - This example will NOT work until you have generated your public
* and private keys. Please see the example documentation on generating your
* keys and also see the documentation on how to save those keys.
*
* Also please be aware that you CANNOT create an invoice until you have paired
* the keys and received a token back. The token is usesd with the request.
*/
require __DIR__ . '/../vendor/autoload.php';
/**
* Create a new client. You can see the example of how to configure this using
* a yml file as well.
*/
$bitpay = new \Bitpay\Bitpay(
array(
'bitpay' => array(
'network' => 'testnet', // testnet or livenet, default is livenet
'public_key' => getenv('HOME').'/.bitpayphp/api.pub',
'private_key' => getenv('HOME').'/.bitpayphp/api.key',
'key_storage' => 'Bitpay\Storage\FilesystemStorage',
)
)
);
/**
* Create the client that will be used to send requests to BitPay's API
*/
$client = $bitpay->get('client');
$tokens = $client->getTokens();
print_r($tokens);