Permalink
Browse files

Adding examples to README.

  • Loading branch information...
1 parent 4be4a6a commit 11afa64efde62e84ca5d382a37d0c79d85cf79d6 @stevenwei committed Apr 22, 2010
Showing with 58 additions and 1 deletion.
  1. +58 −1 README.md
View
@@ -1 +1,58 @@
-A Chargify API client written in Python.
+A [Chargify API](http://support.chargify.com/faqs/api/api-user-guide) client written in Python.
+
+Basic Usage
+-----------
+See the test cases for a full list of examples for all supported API calls.
+
+ chargify = Chargify('api_key','subdomain')
+
+ # List customers
+ result = chargify.customers()
+
+ # List a specific customer
+ result = chargify.customers(customer_id=123)
+
+ # Create a customer
+ result = chargify.customers.create(data={
+ 'customer':{
+ 'first_name':'Joe',
+ 'last_name':'Blow',
+ 'email':'joe@example.com'
+ }
+ })
+
+ # Update a customer
+ result = chargify.customers.update(customer_id=123,data={
+ 'customer':{
+ 'email':'joe@example.com'
+ }
+ })
+
+ # Create a subscription
+ result = chargify.subscriptions.create(data={
+ 'subscription':{
+ 'product_handle':'my_product',
+ 'customer_attributes':{
+ 'first_name':'Joe',
+ 'last_name':'Blow',
+ 'email':'joe@example.com'
+ },
+ 'credit_card_attributes':{
+ 'full_number':'1',
+ 'expiration_month':'10',
+ 'expiration_year':'2020'
+ }
+ }
+ })
+
+ # Cancel a subscription
+ result = chargify.subscriptions.delete(subscription_id=123,data={
+ 'subscription':{
+ 'cancellation_message':'Goodbye!'
+ }
+ })
+
+ # Migrate a subscription
+ result = chargify.subscriptions.migrations.create(subscription_id=123,data={
+ 'product_id':1234
+ })

0 comments on commit 11afa64

Please sign in to comment.