NAME

Net::Stripe::Simple - simple, non-Moose interface to the Stripe API

SYNOPSIS

use Net::Stripe::Simple;

my $stripe = Net::Stripe::Simple->new('sk_test_00000000000000000000000000');

# when the only argument is an id, that's all you need
my $c1 = $stripe->customers( retrieve => 'cus_meFAKEfakeFAKE' );

# you can provide arguments as a hash reference
my $c2 = $stripe->customers( retrieve => { id => 'cus_ImFAKEfakeFAKE' } );

# or as key-value list
my $c3 = $stripe->customers( 'retrieve', id => 'cus_I2FAKEfakeFAKE', expand => 1 );

DESCRIPTION

A lightweight, limited-dependency client to the stripe.com API. This is just a thin wrapper around stripe's RESTful API. It is "simple" in the sense that it is simple to write and maintain and it maps simply onto Stripe's web documentation, so it is simple to use. When you get a response back, it's just the raw JSON blessed with some convenience methods: stringification to ids and autoloaded attributes (Net::Stripe::Simple::Data). If there is an error, the error that is thrown is again just Stripe's JSON with a little blessing (Net::Stripe::Simple::Error).

This simplicity comes at a cost: Net::Stripe::Simple does not validate your parameters aside from those required to construct the URL before constructing a request and sending it off to Stripe. This means that if you've done it wrong it takes a round trip to find out.

For the full details of stripe's API, see https://stripe.com/docs/api.

Method Invocation

Following the organization scheme of Stripe's API, actions are grouped by entity type, each entity corresponding to a method. For a given method there are generally a number of actions, which are treated as the primary key in a parameter hash. Parameters for these actions are provided by a parameter hash which is the value of the primary key. However, there is some flexibility.

Methods that require only an id are flexible. All the following will work:

$stripe->plans( retrieve => { id => $id } );
$stripe->plans( 'retrieve', id => $id );
$stripe->plans( retrieve => $id );

Methods that require no arguments are also flexible:

$stripe->plans( list => { } );
$stripe->plans('list');

Export Tags

Net::Stripe::Simple exports nothing by default. It has four exportable constants and one exportable function:

To facilitate their export, it has two tags:

NAME

Net::Stripe::Simple - simple, non-Moose interface to the Stripe API

METHODS

new

Net::Stripe::Simple->('sk_test_00000000000000000000000000', '2014-01-31')

The class constructor method. The API key is required. The version date is optional. If not supplied, the value of $Net::Stripe::Simple::STRIPE_VERSION will be supplied. Net::Stripe::Simple was implemented or has been updated for the following versions:

The default version will always be the most recent version whose handling required an update to Net::Stripe::Simple.

charges

See https://stripe.com/docs/api#charges.

Available Actions

refunds

See https://stripe.com/docs/api#refunds.

Available Actions

customers

See https://stripe.com/docs/api#customers.

Available Actions

cards

See https://stripe.com/docs/api#cards.

Available Actions

subscriptions

See https://stripe.com/docs/api#subscriptions.

Available Actions

plans

See https://stripe.com/docs/api#plans.

Available Actions

coupons

Available Actions

See https://stripe.com/docs/api#coupons.

discounts

See https://stripe.com/docs/api#discounts.

Available Actions

invoices

See https://stripe.com/docs/api#invoices.

Available Actions

invoice_items

See https://stripe.com/docs/api#invoiceitems.

Available Actions

disputes

See https://stripe.com/docs/api#disputes.

Available Actions

transfers

See https://stripe.com/docs/api#transfers.

Available Actions

recipients

See https://stripe.com/docs/api#recipients.

Available Actions

application_fees

See https://stripe.com/docs/api#application_fees.

Available Actions

account

See https://stripe.com/docs/api#account.

Available Actions

balance

See https://stripe.com/docs/api#balance.

Available Actions

events

See https://stripe.com/docs/api#events.

Available Actions

tokens

See https://stripe.com/docs/api#tokens.

Available Actions

FUNCTIONS

data_object($hash_ref)

This function recursively converts a hash ref into a data object. This is just Net::Stripe::Simple::Data, whose only function is to autoload accessors for all the keys in the hash. It is made for adding magic to JSON objects. If you try to give it something that contains blessed references whose class is outside the JSON namespace it will die.

SEE ALSO

Net::Stripe, Business::Stripe

EXPORTED CONSTANTS

These are just the corresponding JSON constants. They are exported by Net::Stripe::Simple for convenience.

use Net::Stripe::Simple qw(:const);
...
my $subscription = $stripe->subscriptions(
    update => {
        id       => $id,
        customer => $customer_id,
        plan     => $plan_id,
        prorate  => true,
    }
);

You can import the constants individually or all together with :const.

AUTHORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Grant Street Group.

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

AUTHORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Grant Street Group.

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