Rails & Stripe - Stock shipping address in a var, in the ChargesController -


with stripe on rails 4, want stock shipping address of customer in variable @testvar, in chargescontroller, can :
- display in charges#create page, "here deliver"
- send email admin info.

here chargescontroller : (updated 3rd april)

class chargescontroller < applicationcontroller  def new end  def create    admin = admin.last    customer = stripe::customer.create(     email: params[:stripeemail],     card: params[:stripetoken],   )    charge = stripe::charge.create(     :customer    => customer.id,     :amount      => @amount,     :currency    => 'eur',     :receipt_email => params[:stripeemail],   )    customer_name = charge["name"]   adminmailer.outfit_ordered(admin, customer_name).deliver_now   rescue stripe::carderror => e   flash[:error] = e.message   redirect_to :back end end 

update 3rd april i've added mailer, hence 2 following line

  customer_name = charge["name"]   adminmailer.outfit_ordered(admin, customer_name).deliver_now 

i've found following part in another aswer, can't work.

stripe_customer_params = json.parse customer.to_s @testvar = stripe_customer_params['cards']['data'].first['shipping_address'] 

furthermore, when assign random value @testvar (like @testvar = "test") , display in charges#create view, works... @testvar keeps value other tests run after that.

i stuck problem , can't find helps me in stripe's api documentation.

thanks help.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -