Rusty Conover > Net-Stripe-0.20 > Net::Stripe

Download:
Net-Stripe-0.20.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.20   Source  

NAME ^

Net::Stripe - API client for Stripe.com

VERSION ^

version 0.20

SYNOPSIS ^

 my $stripe     = Net::Stripe->new(api_key => $API_KEY);
 my $card_token = 'a token';
 my $charge = $stripe->post_charge(  # Net::Stripe::Charge
     amount      => 12500,
     currency    => 'usd',
     card        => $card_token,
     description => 'YAPC Registration',
 );
 print "Charge was not paid!\n" unless $charge->paid;
 my $card = $charge->card;           # Net::Stripe::Card

 # look up a charge by id
 my $same_charge = $stripe->get_charge(charge_id => $charge->id);

 # ... and the api mirrors https://stripe.com/docs/api
 # Charges: post_charge() get_charge() refund_charge() get_charges()
 # Customer: post_customer() 

DESCRIPTION ^

This module is a wrapper around the Stripe.com HTTP API. Methods are generally named after the HTTP method and the object name.

This method returns Moose objects for responses from the API.

METHODS ^

new PARAMHASH

This creates a new stripe api object. The following parameters are accepted:

api_key

This is required. You get this from your Stripe Account settings.

debug

You can set this to true to see extra debug info.

debug_network

You can set this to true to see the actual network requests.

ATTRIBUTES ^

api_base

Reader: api_base

Type: Str

Additional documentation: This is the base part of the URL for every request made

api_key

Reader: api_key

Type: Str

This attribute is required.

Additional documentation: You get this from your Stripe Account settings

debug

Reader: debug

Writer: debug

Type: Bool

Additional documentation: The debug flag

debug_network

Reader: debug_network

Writer: debug_network

Type: Bool

Additional documentation: The debug network request flag

ua

Reader: ua

Type: Object

Additional documentation: The LWP::UserAgent that is used for requests

Balance Transaction Methods ^

get_balance_transaction

Retrieve a balance transaction

https://stripe.com/docs/api#retrieve_balance_transaction

Returns a Net::Stripe::BalanceTransaction

  $stripe->get_balance_transaction(id => 'id');

Charge Methods ^

post_charge

Create a new charge

https://stripe.com/docs/api#create_charge

Returns Net::Stripe::Charge

  $stripe->post_charge(currency => 'USD', amount => 500, customer => 'testcustomer');

get_charge

Retrieve a charge.

https://stripe.com/docs/api#retrieve_charge

Returns Net::Stripe::Charge

  $stripe->get_charge(charge_id => 'chargeid');

refund_charge

Refunds a charge

https://stripe.com/docs/api#refund_charge

Returns a new Net::Stripe::Charge.

  $stripe->refund_charge(charge => $charge, amount => 500);

get_charges

Returns a Net::Stripe::List object containing Net::Stripe::Charge objects.

https://stripe.com/docs/api#list_charges

Returns a list of Net::Stripe::Charge objects.

  $stripe->get_charges(customer => $customer, limit => 5);

Customer Methods ^

post_customer

Create or update a customer.

https://stripe.com/docs/api#create_customer

Returns a Net::Stripe::Customer object

  my $customer = $stripe->post_customer(
    card => $fake_card,
    email => 'stripe@example.com',
    description => 'Test for Net::Stripe',
  );

list_subscriptions

Returns the subscriptions for a customer

https://stripe.com/docs/api#list_subscriptions

Returns a list of Net::Stripe::Subscription objects

get_customer

Retrieve a customer

https://stripe.com/docs/api#retrieve_customer

Returns a Net::Stripe::List object containing Net::Stripe::Customer objects.

  $stripe->get_customer(customer_id => $id);

delete_customer

Delete a customer

https://stripe.com/docs/api#delete_customer

Returns a Net::Stripe::Customer object

  $stripe->delete_customer(customer => $customer);

get_customers

Returns a list of customers.

https://stripe.com/docs/api#list_customers

Returns a Net::Stripe::List object containing Net::Stripe::Customer objects.

  $stripe->get_customers(limit => 7);

Card Methods ^

get_card

Retrieve information about a customer's card.

https://stripe.com/docs/api#retrieve_card

Returns a Net::Stripe::Card

  $stripe->get_card(customer => 'customer_id', card_id => 'abcdef');

post_card

Create or update a card

https://stripe.com/docs/api#create_card

Returns a Net::Stripe::Card

  $stripe->create_card(customer => $customer, card => $card);

get_cards

Returns a list of cards

https://stripe.com/docs/api#list_cards

Returns a Net::Stripe::List object containing Net::Stripe::Card objects.

  $stripe->list_cards(customer => 'abcdec', limit => 10);

delete_card

Delete a card.

https://stripe.com/docs/api#delete_card

Returns a Net::Stripe::Card.

  $stripe->delete_card(customer => $customer, card => $card);

Subscription Methods ^

post_subscription

Adds or updates a subscription for a customer.

https://stripe.com/docs/api#create_subscription

Returns a Net::Stripe::Customer object

  $stripe->post_subscription(customer => $customer, plan => 'testplan');

get_subscription

Returns a customers subscription

Returns a Net::Stripe::Subscription

  $stripe->get_subscription(customer => 'test123');

delete_subscription

Cancel a customer's subscription

https://stripe.com/docs/api#cancel_subscription

Returns a Net::Stripe::Subscription object.

  $stripe->delete_subscription(customer => $customer, subscription => $subscription);

Token Methods ^

post_token

Create a new token

https://stripe.com/docs/api#create_card_token

card - Net::Stripe::Card or HashRef

Returns a Net::Stripe::Token

  $stripe->post_token(card => $test_card);

get_token

Retreives an existing token.

https://stripe.com/docs/api#retrieve_token

Returns a Net::Stripe::Token

  $stripe->get_token(token_id => 'testtokenid');

Plan Methods ^

post_plan

Create a new plan

https://stripe.com/docs/api#create_plan

Returns a Net::Stripe::Plan object

  $stripe->post_plan(
     id => "free-$future_ymdhms",
     amount => 0,
     currency => 'usd',
     interval => 'year',
     name => "Freeplan $future_ymdhms",
  );

get_plan

Retrieves a plan.

Returns a Net::Stripe::Plan

  $stripe->get_plan(plan_id => 'plan123');

delete_plan

Delete a plan.

https://stripe.com/docs/api#delete_plan

Returns a Net::Stripe::Plan object

  $stripe->delete_plan(plan_id => $plan);

get_plans

Return a list of Plans

https://stripe.com/docs/api#list_plans

Returns a Net::Stripe::List object containing Net::Stripe::Plan objects.

  $stripe->get_plans(limit => 10);

Coupon Methods ^

post_coupon

Create or update a coupon

https://stripe.com/docs/api#create_coupon

Returns a Net::Stripe::Coupon object.

  $stripe->post_coupon(
     id => $coupon_id,
     percent_off => 100,
     duration => 'once',
     max_redemptions => 1,
     redeem_by => time() + 100,
  );

get_coupon

Retreive a coupon

https://stripe.com/docs/api#retrieve_coupon

Returns a Net::Stripe::Coupon object.

  $stripe->get_coupon(coupon_id => 'id');

delete_coupon

Delete a coupon

https://stripe.com/docs/api#delete_coupon

Returns a Net::Stripe::Coupon

  $stripe->delete_coupon(coupon_id => 'coupon123');

get_coupons

Returns a Net::Stripe::List object containing Net::Stripe::Coupon objects.

  $stripe->get_coupons(limit => 15);

Invoice Methods ^

post_invoice

Update an invoice

Returns a Net::Stripe::Invoice

  $stripe->post_invoice(invoice => $invoice, closed => 'true')

get_invoice

Returns a Net::Stripe::Invoice

  $stripe->get_invoice(invoice_id => 'testinvoice');

pay_invoice

Returns a Net::Stripe::Invoice

  $stripe->pay_invoice(invoice_id => 'testinvoice');

get_invoices

Returns a list of invoices

https://stripe.com/docs/api#list_customer_invoices

Returns a Net::Stripe::List object containing Net::Stripe::Invoice objects.

  $stripe->get_invoices(limit => 10);

create_invoice

Create a new invoice

https://stripe.com/docs/api#create_invoice

Returns a Net::Stripe::Invoice

  $stripe->create_invoice(customer => 'custid', description => 'test');

get_invoice

Returns a Net::Stripe::Invoice

  $stripe->get_invoice(invoice_id => 'test');

get_upcominginvoice

Returns a Net::Stripe::Invoice

  $stripe->get_upcominginvoice(customer => $customer);

Invoice Item Methods ^

create_invoiceitem

Create an invoice item.

https://stripe.com/docs/api#create_invoiceitem

Returns a Net::Stripe::Invoiceitem object

  $stripe->create_invoiceitem(customer => 'test', amount => 500, currency => 'USD');

post_invoiceitem

Update an invoice item.

https://stripe.com/docs/api#create_invoiceitem

Returns a Net::Stripe::Invoiceitem

  $stripe->post_invoiceitem(invoice_item => 'itemid', amount => 750);

get_invoiceitem

Retrieve an invoice item.

Returns a Net::Stripe::Invoiceitem

  $stripe->get_invoiceitem(invoice_item => 'testitemid');

delete_invoiceitem

Delete an invoice item

Returns a Net::Stripe::Invoiceitem

  $stripe->delete_invoiceitem(invoice_item => $invoice_item);

get_invoiceitems

Returns a Net::Stripe::List object containing Net::Stripe::Invoiceitem objects.

  $stripe->get_invoiceitems(customer => 'test', limit => 30);

=discount_method delete_customer_discount

Deleting a Customer-wide Discount

https://stripe.com/docs/api/curl#delete_discount

  $stripe->delete_customer_discount(customer => $customer);

returns hashref of the form

  {
    deleted => <bool>
  }

SEE ALSO ^

https://stripe.com, https://stripe.com/docs/api

AUTHORS ^

CONTRIBUTORS ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Prime Radiant, Inc., (c) copyright 2014 Lucky Dinosaur LLC..

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

syntax highlighting: