Skip to content

Latest commit

 

History

History
89 lines (59 loc) · 2.34 KB

README.md

File metadata and controls

89 lines (59 loc) · 2.34 KB

Cubits PHP Client Library

An easy way to buy, send, and accept bitcoin through the Cubits API.

This library supports API key authentication method

Installation

require_once("/path/to/cubits-php/lib/Cubits.php");

Usage

Start by enabling an API Key on your account.

Next, configure the Cubits library via Cubits::configure method and create an instance of the client using the Cubits::withApiKey method:

 Cubits::configure("https://pay.cubits.com/api/v1/",true);
 $cubits = Cubits::withApiKey($_ENV['Cubits_API_KEY'], $_ENV['Cubits_API_SECRET'])

Examples

Create an Invoice

$response = $cubits->createInvoice("Your Order #1234", "42.95", "EUR", array(
            "description" => "1 widget at EUR 42.95",
            "reference" =>  "my custom tracking code for this order"
        ));

Get an Invoice

$response = $cubits->getInvoice("ef73a6ed61a8c97427eaae2073b9127b");

Send Money

$response = $cubits->sendMoney("3Pj4mJfK62n9mjMRcHYs96nd15UQLHHhPS","0.25120521");

List Accounts

$response = $cubits->listAccounts();

Request Quote

$response = $cubits->requestQuote("buy","EUR","10","BTC");

Buy

$response = $cubits->buy("EUR","10");

Sell

$response = $cubits->sell("0.150","EUR");

createChannel

$response =  $cubits->createChannel("EUR");

getChannel

  $cubits->getChannel("7ff31a5843887cbaffb9adb3fcb2aebd");

updateChannel

$response = $cubits->updateChannel("7ff31a5843887cbaffb9adb3fcb2aebd", "EUR", "Alpaca underwear");

Security notes

If someone gains access to your API Key they will have complete control of your Cubits account. This includes the abillity to send all of your bitcoins elsewhere.

For this reason, API access is disabled on all Cubits accounts by default. If you decide to enable API key access you should take precautions to store your API key securely in your application. How to do this is application specific, but it's something you should research if you have never done this before.