SYNOPSIS

        use API::Stripe;
    
        my $stripe = API::Stripe->new(
            username   => 'USERNAME',
            identifier => 'APPLICATION (yourname@example.com)',
        );
    
        my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
        my $results = $charge->fetch;
    
        # after some introspection
    
        $charge->update;

DESCRIPTION

    This distribution provides an object-oriented thin-client library for
    interacting with the Stripe (https://stripe.com) API. For usage and
    documentation information visit https://stripe.com/docs/api.

THIN CLIENT

    A thin-client library is advantageous as it has complete API coverage
    and can easily adapt to changes in the API with minimal effort. As a
    thin-client library, this module does not map specific HTTP requests to
    specific routines, nor does it provide parameter validation,
    pagination, or other conventions found in typical API client
    implementations, instead, it simply provides a simple and consistent
    mechanism for dynamically generating HTTP requests. Additionally, this
    module has support for debugging and retrying API calls as well as
    throwing exceptions when 4xx and 5xx server response codes are
    returned.

 Building

        my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
        my $refunds = $charge->refunds;
    
        $refunds->action; # GET /charges/ch_163Gh12CVMZwIkvc/refunds
        $refunds->action('head'); # HEAD /charges/ch_163Gh12CVMZwIkvc/refunds

    Building up an HTTP request object is extremely easy, simply call
    method names which correspond to the API's path segments in the
    resource you wish to execute a request against. This module uses
    autoloading and returns a new instance with each method call. The
    following is the equivalent:

        my $charge = $stripe->resource(charges => 'ch_163Gh12CVMZwIkvc');
        my $refunds = $charge->resource('refunds');
    
        # or
    
        my $refunds = $stripe->resource('charges', 'ch_163Gh12CVMZwIkvc', 'refunds');
    
        # then
    
        $refunds->action('put', %args); # PUT /charges/ch_163Gh12CVMZwIkvc/refunds

    Because each call returns a new API instance configured with a resource
    locator based on the supplied parameters, reuse and request isolation
    are made simple, i.e., you will only need to configure the client once
    in your application.

 Fetching

        my $charges = $stripe->charges;
    
        $charges->fetch(
            query => {
                # query-string parameters
            },
        );
    
        # equivalent to
    
        $stripe->resource('charges')->action(
            get => ( query => { ... } )
        );

    This example illustrates how you might fetch an API resource.

 Creating

        my $charges = $stripe->charges;
    
        $charges->create(
            data => {
                # content-body parameters
            },
            query => {
                # query-string parameters
            },
        );
    
        # or
    
        my $charges = $stripe->charges;
    
        $charges->create(...);
    
        # equivalent to
    
        $stripe->resource('charges')->action(
            post => ( query => { ... }, data => { ... } )
        );

    This example illustrates how you might create a new API resource.

 Updating

        my $charges = $stripe->charges;
        my $charge  = $charges->resource('ch_163Gh12CVMZwIkvc');
    
        $charge->update(
            data => {
                # content-body parameters
            },
            query => {
                # query-string parameters
            },
        );
    
        # or
    
        my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
    
        $charge->update(...);
    
        # equivalent to
    
        $stripe->resource('charges')->action(
            put => ( query => { ... }, data => { ... } )
        );

    This example illustrates how you might update a new API resource.

 Deleting

        my $charges = $stripe->charges;
        my $charge  = $charges->resource('ch_163Gh12CVMZwIkvc');
    
        $charge->delete(
            data => {
                # content-body parameters
            },
            query => {
                # query-string parameters
            },
        );
    
        # or
    
        my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
    
        $charge->delete(...);
    
        # equivalent to
    
        $stripe->resource('charges')->action(
            delete => ( query => { ... }, data => { ... } )
        );

    This example illustrates how you might delete an API resource.

 Transacting

        my $charges = $stripe->resource('charges', 'ch_163Gh12CVMZwIkvc');
    
        my ($results, $transaction) = $charges->fetch(...);

    This example illustrates how you can access the transaction object used
    to submit the HTTP request.

        $stripe->identifier;
        $stripe->identifier('IDENTIFIER');

    The identifier parameter should be set to a string that identifies your
    app.

        $stripe->username;
        $stripe->username('USERNAME');

    The username parameter should be set an API key associated with your
    account.

        $stripe->debug;
        $stripe->debug(1);

    The debug attribute if true prints HTTP requests and responses to
    standard out.

        $stripe->fatal;
        $stripe->fatal(1);

    The fatal attribute if true promotes 4xx and 5xx server response codes
    to exceptions, a API::Stripe::Exception object.

        $stripe->retries;
        $stripe->retries(10);

    The retries attribute determines how many times an HTTP request should
    be retried if a 4xx or 5xx response is received. This attribute
    defaults to 1.

        $stripe->timeout;
        $stripe->timeout(5);

    The timeout attribute determines how long an HTTP connection should be
    kept alive. This attribute defaults to 10.

        $stripe->url;
        $stripe->url(Mojo::URL->new('https://api.stripe.com'));

    The url attribute set the base/pre-configured URL object that will be
    used in all HTTP requests. This attribute expects a Mojo::URL object.

        $stripe->user_agent;
        $stripe->user_agent(Mojo::UserAgent->new);

    The user_agent attribute set the pre-configured UserAgent object that
    will be used in all HTTP requests. This attribute expects a
    Mojo::UserAgent object.

        my $result = $stripe->action($verb, %args);
    
        # e.g.
    
        $stripe->action('head', %args);   # HEAD request
        $stripe->action('optons', %args); # OPTIONS request
        $stripe->action('patch', %args);  # PATCH request

    The action method issues a request to the API resource represented by
    the object. The first parameter will be used as the HTTP request
    method. The arguments, expected to be a list of key/value pairs, will
    be included in the request if the key is either data or query.

        my $results = $stripe->create(%args);
    
        # or
    
        $stripe->POST(%args);

    The create method issues a POST request to the API resource represented
    by the object. The arguments, expected to be a list of key/value pairs,
    will be included in the request if the key is either data or query.

        my $results = $stripe->delete(%args);
    
        # or
    
        $stripe->DELETE(%args);

    The delete method issues a DELETE request to the API resource
    represented by the object. The arguments, expected to be a list of
    key/value pairs, will be included in the request if the key is either
    data or query.

        my $results = $stripe->fetch(%args);
    
        # or
    
        $stripe->GET(%args);

    The fetch method issues a GET request to the API resource represented
    by the object. The arguments, expected to be a list of key/value pairs,
    will be included in the request if the key is either data or query.

        my $results = $stripe->update(%args);
    
        # or
    
        $stripe->PUT(%args);

    The update method issues a PUT request to the API resource represented
    by the object. The arguments, expected to be a list of key/value pairs,
    will be included in the request if the key is either data or query.

        $stripe->account;

    The account method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#account.

        $stripe->application_fees;

    The application_fees method returns a new instance representative of
    the API resource requested. This method accepts a list of path segments
    which will be used in the HTTP request. The following documentation can
    be used to find more information.
    https://stripe.com/docs/api#application_fees.

        $stripe->balance->history;

    The balance method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#balance.

        $stripe->bitcoin->receivers;

    The bitcoin-receivers method returns a new instance representative of
    the API resource requested. This method accepts a list of path segments
    which will be used in the HTTP request. The following documentation can
    be used to find more information.
    https://stripe.com/docs/api#bitcoin_receivers.

        $stripe->cards;

    The cards method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#cards.

        $stripe->charges;

    The charges method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#charges.

        $stripe->coupons;

    The coupons method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#coupons.

        $stripe->customers;

    The customers method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#customers.

        $stripe->discounts;

    The discounts method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#discounts.

        $stripe->disputes;

    The disputes method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#disputes.

        $stripe->events;

    The events method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#events.

        $stripe->files;

    The files method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information.
    https://stripe.com/docs/api#file_uploads.

        $stripe->invoiceitems;

    The invoiceitems method returns a new instance representative of the
    API resource requested. This method accepts a list of path segments
    which will be used in the HTTP request. The following documentation can
    be used to find more information.
    https://stripe.com/docs/api#invoiceitems.

        $stripe->invoices;

    The invoices method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#invoices.

        $stripe->plans;

    The plans method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#plans.

        $stripe->recipients;

    The recipients method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#recipients.

        $stripe->refunds;

    The refunds method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#refunds.

        $stripe->subscriptions;

    The subscriptions method returns a new instance representative of the
    API resource requested. This method accepts a list of path segments
    which will be used in the HTTP request. The following documentation can
    be used to find more information.
    https://stripe.com/docs/api#subscriptions.

        $stripe->tokens;

    The tokens method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#tokens.

        $stripe->transfers;

    The transfers method returns a new instance representative of the API
    resource requested. This method accepts a list of path segments which
    will be used in the HTTP request. The following documentation can be
    used to find more information. https://stripe.com/docs/api#transfers.

POD ERRORS

    Hey! The above document had some coding errors, which are explained
    below:

    Around line 175:

      Unknown directive: =param

    Around line 182:

      Unknown directive: =param

    Around line 189:

      Unknown directive: =attr

    Around line 196:

      Unknown directive: =attr

    Around line 204:

      Unknown directive: =attr

    Around line 212:

      Unknown directive: =attr

    Around line 220:

      Unknown directive: =attr

    Around line 228:

      Unknown directive: =attr

    Around line 236:

      Unknown directive: =method

    Around line 252:

      Unknown directive: =method

    Around line 264:

      Unknown directive: =method

    Around line 276:

      Unknown directive: =method

    Around line 288:

      Unknown directive: =method

    Around line 300:

      Unknown directive: =resource

    Around line 309:

      Unknown directive: =resource

    Around line 318:

      Unknown directive: =resource

    Around line 327:

      Unknown directive: =resource

    Around line 336:

      Unknown directive: =resource

    Around line 345:

      Unknown directive: =resource

    Around line 354:

      Unknown directive: =resource

    Around line 363:

      Unknown directive: =resource

    Around line 372:

      Unknown directive: =resource

    Around line 381:

      Unknown directive: =resource

    Around line 390:

      Unknown directive: =resource

    Around line 399:

      Unknown directive: =resource

    Around line 408:

      Unknown directive: =resource

    Around line 417:

      Unknown directive: =resource

    Around line 426:

      Unknown directive: =resource

    Around line 435:

      Unknown directive: =resource

    Around line 444:

      Unknown directive: =resource

    Around line 453:

      Unknown directive: =resource

    Around line 462:

      Unknown directive: =resource

    Around line 471:

      Unknown directive: =resource

