initial test for figuring out the stripe webhook

This commit is contained in:
Kyle Drake 2014-04-27 17:27:53 -07:00
parent 0e58904dc9
commit d994536017

9
app.rb
View file

@ -12,9 +12,11 @@ use Rack::Recaptcha, public_key: $config['recaptcha_public_key'], private_key: $
helpers Rack::Recaptcha::Helpers
before do
if request.path.match(/^\/api\//i)
if request.path.match /^\/api\//i
@api = true
content_type :json
elsif request.path.match /^\/stripe_webhook$/
# Skips the CSRF check for stripe web hooks
else
content_type :html, 'charset' => 'utf-8'
redirect '/' if request.post? && !csrf_safe?
@ -705,6 +707,11 @@ post '/contact' do
end
end
post '/stripe_webhook' do
event_json = JSON.parse(request.body.read)
puts event_json.inspect
end
post '/api/upload' do
require_api_credentials