stripe payment issue ruby on rails

Posted by Admir Huric on Stack Overflow See other posts from Stack Overflow or by Admir Huric
Published on 2013-10-17T19:45:24Z Indexed on 2013/10/17 21:54 UTC
Read the original article Hit count: 282

So I have made a stripe payment option in my app. When I click the button pay now, it shows me that the payment is successful. and when I go to my stripe account and go to stripe-test and check logs, I can see my test payment with the code 200 OK. But this payment doesn't show in stripe-test events, or in stripe-test payments. Are the payments from logs processed the next day or am I doing something wrong?

def charge
  Stripe.api_key = "some_test_api_key"
  customer = Stripe::Customer.retrieve(stripe_customer_id)

  if stripe_customer_id.nil?
    Stripe::Charge.create(
      :amount => 2500,
      :currency => "cad",
      :customer => stripe_customer_id,
      :description => "Usage charges for #{name}"
    )
  end
  rescue Stripe::StripeError => e
    logger.error "Stripe Error: " + e.message
    errors.add :base, "Unable to process charge. #{e.message}."
    false
  end

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby