The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Coinbase - Coinbase (http://coinbase.com) API bindings

VERSION

version 0.0200

SYNOPSIS

    use WebService::Coinbase;

    my $coin = WebService::Coinbase->new(
        api_key    => 'API_KEY',
        api_secret => 'API_SECRET',
        logger     => Log::Tiny->new('/tmp/coin.log'), # optional
    );
    my $accounts = $coin->get_accounts();

METHODS

get_accounts

    get_accounts()

Returns the user's active accounts.

get_account

    get_account($account_id)

Returns one of the user's active accounts.

get_primary_account

    get_primary_account()

Returns the user's primary account.

set_primary_account

    set_primary_account($account_id)

Sets the primary account.

create_account

    create_account($data)

Creates a new account for the user.

Example:

    my $account = $coin->create_account({ name => "Bling Bling" });

get_balance

    get_balance()

Returns the user's current balance.

get_account_balance

    get_account_balance($account_id)

Returns the current balance for the given account.

get_account_address

    get_account_address($account_id)

Returns the user's current bitcoin receive address.

create_account_address

    create_account_address($account_id, $data)

Generates a new bitcoin receive address for the user.

Example:

    $coin->create_account_address($account_id, {
        label        => 'college fund',
        callback_url => 'http://foo.com/bar',
    });

modify_account

    modify_account($account_id, $data)

Modifies an account.

Example:

    $coin->modify_account($acct_id, { name => "Kanye's Account" });

delete_account

    delete_account($account_id)

Deletes an account. Only non-primary accounts with zero balance can be deleted.

get_addresses

    get_addresses()

Returns the bitcoin addresses a user has associated with their account.

get_address

    get_address($id_or_address)

Returns the bitcoin address object for the given id or address.

get_contacts

    get_contacts()

Returns contacts the user has previously sent to or received from.

get_transactions

    get_transactions()

Returns the user's transactions sorted by created_at in descending order.

get_transaction

    get_transaction($transaction_id)

Returns the transaction for the given id.

send_money

    send_money($data)

Send money to an email or bitcoin address.

Example:

    $coin->send_money({
        to       => $email_or_bitcoin_address,
        amount   => '1.23',
        notes    => 'Here is your money',
    });

transfer_money

    transfer_money($data)

Transfer bitcoin between accounts.

request_money

    request_money($data)

Request money from an email.

resend_request

    resend_request($transaction_id)

Resend a money request.

complete_request

    complete_request($transaction_id)

Lets the recipient of a money request complete the request by sending money to the user who requested the money. This can only be completed by the user to whom the request was made, not the user who sent the request.

cancel_request

    cancel_request($transaction_id)

Cancel a money request.

get_buy_price

    get_buy_price()
    get_buy_price(query => { qty => 1 })

get_sell_price

    get_sell_price()
    get_sell_price(query => { qty => 1 })

get_spot_price

    get_spot_price()
    get_spot_price(query => { currency  => 'CAD' })

get_orders

    get_orders()

Returns a merchant's orders that they have received.

create_order

    create_order($data)

Returns an order for a new button.

Example:

    $coin->create_order({
        name               => 'test',
        price_string       => '1.23',
        price_currency_iso => 'BTC',
    });

get_order

    get_order($order_id)

Returns order details.

refund_order

    refund_order($order_id, $data)

Refunds an order.

Example:

    $coin->refund_order($order_id, { refund_iso_code => 'BTC' })

AUTHOR

Naveed Massjouni <naveed@vt.edu>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Naveed Massjouni.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.