NAME

WebService::Stripe - Stripe API bindings

VERSION

version 0.0600

SYNOPSIS

my $stripe = WebService::Stripe->new(
    api_key => 'secret',
    version => '2014-11-05', # optional
);
my $customer = $stripe->get_customer('cus_57eDUiS93cycyH');

METHODS

get_customer

get_customer($id)

Returns the customer for the given id.

create_customer

create_customer($data)

Creates a customer. The $data hashref is optional. Returns the customer.

Example:

$customer = $stripe->create_customer({ email => 'bob@foo.com' });

update_customer

update_customer($id, $data)

Updates a customer. Returns the updated customer.

Example:

$customer = $stripe->update_customer($id, { description => 'foo' });

get_customers

get_customers(query => $query)

Returns a list of customers. The query param is optional.

next

next($collection)

Returns the next page of results for the given collection.

Example:

my $customers = $stripe->get_customers;
...
while ($customers = $stripe->next($customers)) {
    ...
}

create_card

create_card($data, customer_id => 'cus_123')

get_charge

get_charge($id)

Returns the charge for the given id.

create_charge

create_charge($data)

Creates a charge.

capture_charge

capture_charge($id, data => $data)

Captures the charge with the given id. The data param is optional.

refund_charge

refund_charge($id, data => $data)

Refunds the charge with the given id. The data param is optional.

get_token

get_token($id)

create_token

create_token($data)

get_account

get_account($id)

create_account

create_account($data)

update_account

update_account($id, data => $data)

add_bank

add_bank($data, account_id => $account_id)

Add a bank to an account.

Example:

my $account = $stripe->create_account({
    managed => 'true',
    country => 'CA',
});

my $bank = $stripe->add_bank(
    {
        'bank_account[country]'        => 'CA',
        'bank_account[currency]'       => 'cad',
        'bank_account[routing_number]' => '00022-001',
        'bank_account[account_number]' => '000123456789',
    },
    account_id => $account->{id},
);

# or add a tokenised bank

my $bank_token = $stripe->create_token({
    'bank_account[country]'        => 'CA',
    'bank_account[currency]'       => 'cad',
    'bank_account[routing_number]' => '00022-001',
    'bank_account[account_number]' => '000123456789',
});

$stripe->add_bank(
    { bank_account => $bank_token->{id} },
    account_id => $account->{id},
);

update_bank

update_bank($id, account_id => $account_id, data => $data)

create_transfer

create_transfer($data)

get_transfer

get_transfer($id)

get_transfers

get_transfers(query => $query)

update_transfer

update_transfer($id, data => $data)

cancel_transfer

cancel_transfer($id)

AUTHOR

Naveed Massjouni <naveed@vt.edu>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Tilt, Inc.

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