http://chargify.com/ ==> Sign Up to Chargify.
(we can have a developer account at free of cost.)
Enable API Access key
Create a New Site (SUBMIT DETAILS => site name, sub-domain, Currency, Time-Zone etc.)
<!– In Setup tab –> Create a Product Family.
in that we have to add products....
For a Product we have to submit =>
(Product NAME, BILLING SETUP ==> Trial period in months/days)
if we want we can reditect URLs ...
your api access kiy : ‘nij2dluc3AYv3RL3yTz3’
EXAMPLE
sub-domain : YOUR-USER-NAME.chargify.com/
IN RAILS APPLICATION @@@@@@@
ADD A GEM IN Gemfile
gem ‘chargify_api_ares’
in application.rb
initialize
require ‘chargify_api_ares’
Chargify.configure do |c| c.api_key = 'api-access-KEY' c.site = "https://saisagar.chargify.com/" end
build a form for getting the details from the user
(LIKE => credit_card_number,cvv, first name on card, expiry date, )
in the controller @@@
product_handle = 'apisaisagar' (PERTICULAR PRODUCT'S {product_handle} FROM CHARGIFY SITE)
CREATE A Chargify::Subscription
------
@subscription = Chargify::Subscription.create(
:product_handle => product_handle,
:customer_attributes => {
:first_name => params[:payment]['first_name'],
:last_name => params[:payment]['last_name'],
:email => params[:payment]['email_address'],
},
:credit_card_attributes => {
:expiration_month => params[:payment]['expiration_date(2i)'],
:expiration_year => params[:payment]['expiration_date(1i)'],
:full_number => params[:payment]['card_number']
}
)
if @subscription.save
json_object = @subscription.attributes.to_json
parsed_json = JSON.parse(json_object)
subscription_id = parsed_json['id']
session[:subscription_id] = subscription_id;
@payment.update_attributes(:subscription_id => subscription_id)
A PRODUCT ORDER WILL PLACED ON CHARGIFY DASHBOARD