我已使用javascript设置条带自定义结帐。每个参数都会通过,我们在付款时会在日志中收到状态200。一切看起来都是如此。然而,金额仍为" 0"在Parsed Request Query Parameters中,不对卡充电。
我已经过了几个小时的文档,无法解决这个问题。
<script src="https://checkout.stripe.com/checkout.js"></script>
<script>
var pinId = "<%= @id %>";
var from = "<%= @from %>";
var content = "Supersize+me";
var handler = StripeCheckout.configure({
key: 'Published-Key',
image: '/assets/campusboard-logo.png',
token: function(token, args) {
$.getJSON( "purchased/"+pinId )
.done(function( data ) {
window.location = "http://"+window.location.host+"/pins/"+pinId+"?utm_source=Purchased&utm_medium="+from+"&utm_campaign=Featured%20Pins&utm_content="+content;
})
.fail(function( jqxhr, textStatus, error ) {
alert("We've encountered a problem with the transaction. Please try again.");
});
}
});
document.getElementById('ssm').addEventListener('click', function(e) {
// Open Checkout with further options
handler.open({
name: 'CampusBoard',
description: 'Featured Pin (£29.00)',
amount: "100",
currency: 'GBP',
panelLabel: 'Supersize my Pin'
});
e.preventDefault();
});
document.getElementById('mmh').addEventListener('click', function(e) {
// Open Checkout with further options
handler.open({
name: 'CampusBoard',
description: 'Featured Pin (£59.00)',
amount: 5900,
currency: 'GBP',
panelLabel: 'Make my Pin Huge'
});
content = "Make+me+huge";
e.preventDefault();
});
</script>
有人能看到我出错的地方吗?
答案 0 :(得分:1)
Stripe Checkout只是一张做得很好的预付款表格。实际上,您必须使用Stripe secret API密钥在服务器上创建Charge对象。按照these tutorials了解您的特定语言。
答案 1 :(得分:0)
您将金额作为字符串传递,而我认为条纹期望它作为数字。所以:
handler.open({
...
amount: 100,
...
});