Module: StripeHelper
- Defined in:
- lib/stripe_helper.rb,
lib/stripe_helper/engine.rb,
lib/stripe_helper/version.rb,
lib/stripe_helper/configuration.rb,
app/cells/stripe_helper/stripe_cell.rb,
app/helpers/stripe_helper/application_helper.rb,
app/controllers/stripe_helper/stripe_controller.rb,
app/controllers/stripe_helper/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper
Classes: ApplicationController, Configuration, Engine, StripeCell, StripeController
Constant Summary
collapse
- VERSION =
"0.0.3"
Class Method Summary
collapse
Class Method Details
.charge_from_customer(customer_id, opts = {}) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/stripe_helper.rb', line 30
def self.charge_from_customer(customer_id, opts = {})
begin
opts[:customer] = customer_id
return ::Stripe::Charge.create(opts)
rescue ::Stripe::CardError => e
return nil
end
end
|
.charge_from_token(token, opts = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/stripe_helper.rb', line 15
def self.charge_from_token(token, opts = {})
opts[:card] = token
begin
return ::Stripe::Charge.create(opts)
rescue ::Stripe::CardError => e
return nil
end
end
|
.config ⇒ Object
7
8
9
|
# File 'lib/stripe_helper.rb', line 7
def self.config
@@config ||= Configuration.new
end
|
11
12
13
|
# File 'lib/stripe_helper.rb', line 11
def self.configure
yield(self.config)
end
|
.customer_from_token(token, opts = {}) ⇒ Object
25
26
27
28
|
# File 'lib/stripe_helper.rb', line 25
def self.customer_from_token(token, opts = {})
opts[:card] = token
::Stripe::Customer.create(opts)
end
|