mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
initial test for figuring out the stripe webhook
This commit is contained in:
parent
0e58904dc9
commit
d994536017
1 changed files with 8 additions and 1 deletions
9
app.rb
9
app.rb
|
@ -12,9 +12,11 @@ use Rack::Recaptcha, public_key: $config['recaptcha_public_key'], private_key: $
|
||||||
helpers Rack::Recaptcha::Helpers
|
helpers Rack::Recaptcha::Helpers
|
||||||
|
|
||||||
before do
|
before do
|
||||||
if request.path.match(/^\/api\//i)
|
if request.path.match /^\/api\//i
|
||||||
@api = true
|
@api = true
|
||||||
content_type :json
|
content_type :json
|
||||||
|
elsif request.path.match /^\/stripe_webhook$/
|
||||||
|
# Skips the CSRF check for stripe web hooks
|
||||||
else
|
else
|
||||||
content_type :html, 'charset' => 'utf-8'
|
content_type :html, 'charset' => 'utf-8'
|
||||||
redirect '/' if request.post? && !csrf_safe?
|
redirect '/' if request.post? && !csrf_safe?
|
||||||
|
@ -705,6 +707,11 @@ post '/contact' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
post '/stripe_webhook' do
|
||||||
|
event_json = JSON.parse(request.body.read)
|
||||||
|
puts event_json.inspect
|
||||||
|
end
|
||||||
|
|
||||||
post '/api/upload' do
|
post '/api/upload' do
|
||||||
require_api_credentials
|
require_api_credentials
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue