Created
March 16, 2010 15:29
-
-
Save npverni/334096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'chargify_api_ares' | |
Chargify.configure do |c| | |
c.subdomain = '' | |
c.api_key = '' | |
end | |
customer = Chargify::Customer.create( | |
:first_name => "Thomas", | |
:last_name => "Sinclair", | |
:email => "[email protected]" | |
) | |
sub = Chargify::Subscription.create( | |
:customer_id => customer.id, | |
:product_handle => 'brooklyn-local', | |
:credit_card_attributes => { | |
:first_name => "Thomas", | |
:last_name => "Sinclair", | |
:expiration_month => "12", | |
:expiration_year => "2010", | |
:full_number => "1" } | |
) | |
puts sub.id | |
subscription = Chargify::Subscription.find(:first, :conditions => ['customer_id = ?', customer.id]) | |
puts subscription.id | |
puts subscription.credit_card.first_name | |
puts subscription.customer.first_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment