我正在尝试使用播放框架应用程序设置条带支付。我在设置 webhook 时遇到问题。
com.stripe.exception.SignatureVerificationException: No signatures found matching the expected signature for payload
Run Code Online (Sandbox Code Playgroud)
这是我尝试构建从条带发送的事件时不断收到的错误。我打印出正文和签名的值,它们看起来应该是正确的。这是我用来收集 webhook 的代码。
def webhook = Action { implicit request: Request[AnyContent] =>
println(request.headers.toMap)
val bodyOp:Option[JsValue] = request.body.asJson
val sigOp:Option[String] = request.headers.get("Stripe-Signature")
var event: Event = null
if (bodyOp.isEmpty || sigOp.isEmpty) {
WebhookController.logger.write("EMPTY BODY OR SIG body-"+bodyOp+" sig-"+sigOp,Logger.RED)
BadRequest
} else {
val body = bodyOp.get.toString
val sig = sigOp.get
println(body)
println(sig)
try {
event = Webhook.constructEvent(body, sig, "whsec_5XwS8yCNOcq1CKfhh2Dtvm8RaoaE3p7b")
val eventType: String = event.getType
eventType match {
case …Run Code Online (Sandbox Code Playgroud)