Skip to content

Instantly share code, notes, and snippets.

@npverni
Created March 16, 2010 15:29
Show Gist options
  • Save npverni/334096 to your computer and use it in GitHub Desktop.
Save npverni/334096 to your computer and use it in GitHub Desktop.
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