Ror ecommerce

Complete Ruby on Rails Ecommerce platform

Getting Started
Config
The Cart
Accounting
Addresses
Coupons
Deals
Fulfillment
Orders
Product Creation
Referrals
View the Project on GitHub drhenner/ror_ecommerce

This project is maintained by drhenner and many contributors.

ROR Ecommerce

Config

One of the first things you will need to do is setup your gateway to accept credit card payments. You need to open config/settings.yml. REMEMBER this file should never contain sensitive data that you couldn't share with a hacker down the street. All secure data should be store in environmental variables. It is a bit dated but I also I recommend purchasing the Peepcode PDF about active merchant.

  encryption_key: someRandomBINARYKEY
  mailer:
    server: mail.example.com
    username: someLOGIN
    password: s0meth1ngs3cr3t
  paypal:
    ip:         192.168.0.1
    login:      someLOGIN.yahoo.com
    password:   somePASSWORD
    signature:  someSIGNATURE
  authnet:
    login:      <%= ENV['AUTHNET_LOGIN'] %>
    password:   <%= ENV['AUTHNET_PASSWORD'] %>
  vat: false
  require_state_in_address: true

  # tax_per_state_id is a field for tax being applied at the state level or country wide level in "TaxRate model"
  tax_per_state_id: true

  paperclip:
    s3_protocol: https
    s3_credentials:
      access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
      secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
    path: ':class/:attachment/:style/:hash.:extension'
    bucket: <%= ENV['FOG_DIRECTORY'] %>
    hash_secret: f8c07cf79094ec06f77b6024b5d7936c79b5227274fb8e82c00blaha

Mail

If you need help setting mail up I suggest watching the Railscast on Mail I suggest keeping the secure passwords in this yml using enviromental variables and out of your GIT repo but this railscast gives a great tutorial.

Gateways

There are many payment gateways you can use to collect credit card information. Three of the most popular are paypal, authorize.net and braintree. Judging from my experience all work well. My advise is to look at each gateway and make your own choice. Railscasts has a series of good tutorials working with paypal.

Remember NEVER ADD CREDIT CARD INFORMATION in your database. Even encrypted Credit Card information can get you in a lot of trouble. These payments gateways have great ways to store Credit Card information for recurring billing and reusing the credit cards.

If you are in the United States or Canada refactoring the checkout code to use Stripe takes very little time and Stripe offers great advantages for PCI compliance and has an excellent developer sandbox.

Change Gateways

To change from authorize.net to paypal for example you can follow these steps:

First, fill in details into config/settings.yml for paypal:

paypal:
    ip:         192.168.0.1
    login:      someLOGIN.yahoo.com
    password:   somePASSWORD
    signature:  someSIGNATURE
  

Second, change config/environments/*.rb from:

::GATEWAY = ActiveMerchant::Billing::AuthorizeNetGateway.new(
  :login    => Settings.authnet.login,
  :password => Settings.authnet.password,
  :test     => true
)
  
to:
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
  :login      => Settings.paypal.login,
  :password   => Settings.paypal.password,
  :signature  => Settings.paypal.signature,
  :test       => true
)