# Set your secret key: remember to change this to your live secret key in production # See your keys here https://dashboard.stripe.com/account Stripe.api_key = "sk_test_IkMPj9RXMgkkbgwqfSFhzdoR" # Get the credit card details submitted by the form token = params[:stripeToken] # Create the charge on Stripe's servers - this will charge the user's card begin charge = Stripe::Charge.create( :amount => 2499, # amount in cents, again :currency => "gbp", :card => token, :description => "payinguser@example.com" ) rescue Stripe::CardError => e # The card has been declined end
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form :(