我想发送stripe webhook测试。invoice.pyament_succeed
到本地服务器,用 ngrok
. 虽然 ngrok
将工作,当发送webhook从stripe到它的错误发生。
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
configroutes.rb
Rails.application.routes.draw do
mount StripeEvent::Engine, at: '/webhooks/stripe'
end
配置stripe.rb
StripeEvent.configure do |events|
# The case invoice payment succeed
events.subscribe(
'invoice.payment_succeed',
Events::InvoicePaymentSucceed.new
)
end