Add BitPay payment processing support to your PHP application using the BitPay API and Guzzle
Require the library in your composer.json file:
{
"require": {
"symm/guzzle-bitpay": "~1.0"
}
}
use Symm\BitpayClient\BitpayClient;
$client = BitpayClient::createClient('YOUR_API_KEY_HERE');
A client which communicates with the Test Environment
use Symm\BitpayClient\BitpayClient;
$client = BitpayClient::createTestClient('YOUR_TEST_API_KEY_HERE');
$invoice = $client->createInvoice(
array(
'price' => 5,
'currency' => 'GBP',
)
);
print $invoice->getUrl() . PHP_EOL;
$invoice = $client->getInvoice(
array(
'id' => 'YOUR_INVOICE_ID_HERE'
)
);
print $invoice->getStatus() . PHP_EOL;
$invoice = $client->verifyNotification(file_get_contents("php://input"));
$currencyCollection = $client->getRates();
foreach ($currencyCollection as $currency) {
/** @var \Symm\BitpayClient\Model\Currency $currency */
print $currency->getCode() . ': ' . $currency->getRate();
}
use Symm\BitpayClient\Localisation\Language;
print $invoice->getUrl(Language::SPANISH)
Code copyright Gareth Jones and released under the MIT license.