Skip to content

Instantly share code, notes, and snippets.

@MikeSilvis
Created May 8, 2012 03:53
Show Gist options
  • Save MikeSilvis/2632423 to your computer and use it in GitHub Desktop.
Save MikeSilvis/2632423 to your computer and use it in GitHub Desktop.
Billing_Processor
class BillingProcessor
def self.charge(amount, stripe_id)
Stripe::Charge.create(
:amount => amount,
:currency => "usd",
:customer => stripe_id
)
end
def self.create_customer(user_id, token)
user = User.find(user_id)
customer = Stripe::Customer.create(
:card => token,
:description => user.email
)
user.stripe_id = customer.id
user.save
end
end
@j3j3
Copy link

j3j3 commented May 16, 2012

What an amazing gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment