GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::FreshBooks::API::Recurring(3) User Contributed Perl Documentation Net::FreshBooks::API::Recurring(3)

Net::FreshBooks::API::Recurring - FreshBooks Recurring Item access

version 0.24

    use Net::FreshBooks::API;
    use Net::FreshBooks::API::InvoiceLine;
    use DateTime;

    # You will not access this module directly, but rather fetch an object via
    # its parent class, Net::FreshBooks::API

    my $fb = Net::FreshBooks::API->new({ ... });

    # create a new client
    my $client = $fb->client->create(
        {   first_name   => 'Larry',
            last_name    => 'Wall',
            organization => 'Perl HQ',
            email        => 'larry@example.com',
        }
    );

    # create a recurring item
    use Net::FreshBooks::API;

    my $line = Net::FreshBooks::API::InvoiceLine->new({
        name         => "Widget",
        description  => "Net::FreshBooks::API Widget",
        unit_cost    => '1.99',
        quantity     => 1,
        tax1_name    => "GST",
        tax1_percent => 5,
    });
    
    # set up autobill
    
    my $autobill = Net::FreshBooks::API::Recurring::AutoBill->new;
    $autobill->gateway_name('PayPal Payflow Pro');
    $autobill->card->name('Tim Toady');
    $autobill->card->number('4111 1111 1111 1111');
    $autobill->card->expiration->month(12);
    $autobill->card->expiration->year(2015);
    
    # use the client object from the previous example

    my $recurring_item = $fb->recurring->create({
        client_id   => $client->client_id,
        date        => DateTime->now->add( days => 2 )->ymd, # YYYY-MM-DD
        frequency   => 'monthly',
        lines       => [ $line ],
        autobill    => $autobill,
        notes       => 'Created by Net::FreshBooks::API',
    });

    $recurring_item->po_number( 999 );
    $recurring_item->update;

    See also L<Net::FreshBooks::API::Base> for other available methods, such
    as create, update, get, list and delete.

    my $recurring = $fb->recurring->create({...});

    my $item = $recurring->get({ recurring_id => $recurring_id });
    $item->delete;

    my $item = $recurring->get({ recurring_id => $recurring_id });

    $referring->organization('Perl Foundation');
    $referring->update;

    # or more quickly
    $referring->update( { organization => 'Perl Foundation', } );

Returns a Net::FreshBooks::API::Recurring::AutoBill object

    my $autobill = $recurring_item->autobill;
    $autobill->gateway_name('PayPal Payflow Pro');
    $autobill->card->name('Tim Toady');
    $autobill->card->number('4111 1111 1111 1111');
    $autobill->card->expiration->month(12);
    $autobill->card->expiration->year(2015);
    
    $recurring_item->create;

To delete an autobill profile, just set autobill to an empty string prior to update.

    $referring->autobill('');
    $referring->update;

Returns a Net::FreshBooks::API::Iterator object.

    my $recurrings = $fb->recurring->list;
    while ( my $recurring = $recurrings->next ) {
        print $recurring->recurring_id, "\n";
    }

Returns an ARRAYREF of Net::FreshBooks::API::InvoiceLine objects

    foreach my $line ( @{ $recurring->lines } ) {
        print $line->amount, "\n";
    }

    Olaf Alders
    CPAN ID: OALDERS
    olaf@raybec.com

Thanks to Edmund von der Burg for doing all of the hard work to get this module going and for allowing me to act as a co-maintainer.

Thanks to Raybec Communications <http://www.raybec.com> for funding my work on this module and for releasing it to the world.

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

  • Edmund von der Burg <evdb@ecclestoad.co.uk>
  • Olaf Alders <olaf@wundercounter.com>

This software is copyright (c) 2011 by Edmund von der Burg & Olaf Alders.

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

2022-04-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.