stripe payment issue ruby on rails
- by Admir Huric
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