symm/guzzle-bitpay

This package is abandoned and no longer maintained. The author suggests using the bitpay/php-client package instead.

Guzzle client for Bitpay API

v1.1.2 2014-07-05 13:03 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:28:49 UTC


README

Build Status Code Coverage Scrutinizer Quality Score Latest Stable Version Total Downloads Latest Unstable Version License

Add BitPay payment processing support to your PHP application using the BitPay API and Guzzle

Installation

Require the library in your composer.json file:

{
    "require": {
        "symm/guzzle-bitpay": "~1.0"
    }
}

Usage

Create a client

use Symm\BitpayClient\BitpayClient;

$client = BitpayClient::createClient('YOUR_API_KEY_HERE');

Create a Test Environment Client

A client which communicates with the Test Environment

use Symm\BitpayClient\BitpayClient;

$client = BitpayClient::createTestClient('YOUR_TEST_API_KEY_HERE');

Create a new invoice

$invoice = $client->createInvoice(
    array(
        'price'    => 5,
        'currency' => 'GBP',
    )
);

print $invoice->getUrl() . PHP_EOL;

Receive an existing invoice

$invoice = $client->getInvoice(
    array(
        'id' => 'YOUR_INVOICE_ID_HERE'
    )
);

print $invoice->getStatus() . PHP_EOL;

Verify BitPay Notification

$invoice = $client->verifyNotification(file_get_contents("php://input"));

Get exchange rates

$currencyCollection = $client->getRates();
foreach ($currencyCollection as $currency) {
    /** @var \Symm\BitpayClient\Model\Currency $currency */
    print $currency->getCode() . ': ' . $currency->getRate();
}

Localise Invoice page

use Symm\BitpayClient\Localisation\Language;

print $invoice->getUrl(Language::SPANISH)

Resources

Guzzle Documentation

Official API Documentation

Copyright and license

Code copyright Gareth Jones and released under the MIT license.