Class: Chivas::CreditCard

Inherits:
Object
  • Object
show all
Defined in:
lib/chivas/credit_card.rb

Class Method Summary collapse

Class Method Details

.charge(amount, stripe_customer_id) ⇒ Object

To implement guest checkout, the client has to:

1. Create token for credit card (comes from the UI)
2. Save credit card token in the database for one-click checkout for subsequent purchases
3. Charge customer using the stripe_customer_id for the current one-time purchase

To implement one-click checkout, the client has to:

1. Charge customer using the stripe_customer_id

The currency by default is USD



14
15
16
# File 'lib/chivas/credit_card.rb', line 14

def self.charge(amount, stripe_customer_id)
  Stripe::Charge.create(amount: amount, currency: "usd", customer: stripe_customer_id)
end