Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

symm/guzzle-bitpay

Repository files navigation

BitPay Client for PHP

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.

About

[DEPRECATED] Guzzle Client for BitPay API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages