我正在尝试使用invoice.pyament_succeed
将条纹Webhook测试ngrok
发送到本地服务器。尽管ngrok
可以工作,但是当从条带发送webhook时,会发生错误:
POST /webhooks/stripe 500 Internal Server Error
我已经设置了ngrok
和stripe webhook
,如下所示:
1.在本地服务器
ngrok
$ ngrok http 3000
那行得通。
Session Status online
Account xxxxx (Plan: Free)
Update update available (version 2.3.34, Ctrl-U to update)
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://xxxx.ngrok.io -> localhost:3000
Forwarding https://xxxx.ngrok.io -> localhost:3000
输入终点
https://xxxxx.ngrok.io/webhooks/stripe
config / routes.rb
Rails.application.routes.draw do
mount StripeEvent::Engine, at: '/webhooks/stripe'
end
config / stripe.rb
StripeEvent.configure do |events|
# The case invoice payment succeed
events.subscribe(
'invoice.payment_succeed',
Events::InvoicePaymentSucceed.new
)
end