<?xml version="1.0" encoding="UTF-8"?>
<hash>
<status>500</status>
<error>Internal Server Error</error>
</hash>
class WebhockController< ApplicationController
protect_from_forgery except: :create
def create
event = Stripe::Event.retrieve(params[:id])
case event.type
when 'customer.subscription.updated'
subscription = event.data.object
user = User.find_by(stripe_subscription_id: subscription.id)
user.update_subscription(subscription)
end
head :ok
end
end
// routes.rb
post "webhock"=>"webhock#create"
2017-06-14T12:56:32.470036 + 00:00 app [web.1]:在696ms内完成500内部服务器错误(ActiveRecord:0.0ms)