在我的帐户设置> webhooks我有:
url = documentation
模式=测试
发送给我所有活动=✔
但我的node.js代码没有收到webhooks:
var stripe = require("stripe")("sk_test_myapikey");
// Using Express
app.post("/my/webhook/url", function(request, response) {
// Retrieve the request's body and parse it as JSON
var event_json = JSON.parse(request.body);
// Do something with event_json
response.send(200);
});
在官方条纹文档中,除了这个之外,我没有任何例子:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="https://checkout.stripe.com/checkout.js"></script>
<meta charset="utf-8">
<title>Stripe</title>
</head>
<body style="background:#41ACE6;">
<div style="background:url('logo.stripe.png');background-position:center center;background-size:50%;background-repeat:no-repeat;position:fixed;left:0px;right:0px;top:0px;bottom:0px;"></div>
<script>
var handler=StripeCheckout.configure({
key:'pk_test_myapikey'
, image:'icon.png'
, locale:'auto'
, token:function(token){
handler.close();
console.log(token);
var vals=
'<input type="hidden" name="token" value="'+token.id+'"/>'
+'<input type="hidden" name="used" value="'+token.used+'"/>'
+'<input type="hidden" name="provider" value="'+'<?php echo $_POST["provider"];?>'+'"/>'
+'<input type="hidden" name="account_id" value="'+'<?php echo $_POST["account_id"];?>'+'"/>'
+'<input type="hidden" name="quantity" value="'+'<?php echo $_POST["quantity"];?>'+'"/>'
;
$('<form style="display:hidden" action="http://example.com/result.php" method="POST">'+vals+'</form>').submit();
}});
handler.open({
name:'example'
, description:'description'
, currency:"usd"
, amount:<?php echo ((int)$_POST["quantity"])*100;?>
});
</script>
</body>
</html>
memisc