-
-
Save iftikhar0005/d59554a7f4697056d74f to your computer and use it in GitHub Desktop.
Stripe-Connect help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Checkout < ActiveRecord::Base | |
attr_accessible :create, :new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CheckoutsController < ApplicationController | |
#This is the post request i am making... | |
def save_with_payment | |
if valid? | |
customer = Stripe::Customer.create(description: email, card: stripe_card_token) | |
self.stripe_customer_token = customer.id | |
save! | |
end | |
rescue Stripe::InvalidRequestError => e | |
logger.error "Stripe error while creating customer: #{e.message}" | |
errors.add :base, "There was a problem with your credit card." | |
false | |
end | |
def new | |
@checkout = Checkout.new | |
end | |
def create | |
@checkout = Checkout.new(params[:checkout]) | |
if @checkout.save_with_payment | |
redirect_to @checkout, :notice => "Thank you for checkout!" | |
else | |
render :new | |
end | |
end | |
end |
Strip Connect is a way to make your users into vendors. If you are creating a shopping cart, you need to have Stripe integration help, not Stripe Connect.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The way this is written, I don't see what Stripe Connect is doing for you. This is more about Stripe's API, it seems.