繁体   English   中英

条纹-不收费卡

[英]Stripe - Not charging card

我已经使用javascript设置了条纹自定义签出。 每个参数都会通过,当我们付款时,我会在日志中收到状态200。 一切似乎都经历了。 但是,在“已解析的请求查询参数”中,该金额仍为“ 0”,并且不对卡收费。

我已经花了几个小时浏览文档,无法解决这个问题。

<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>

有人可以看到我要去哪里了吗?

Stripe Checkout只是一种完善的预制付款表格。 实际上,您实际上必须使用Stripe秘密API密钥在服务器上创建Charge对象。 按照这些教程来学习您的特定语言。

您将金额作为字符串传递,而我认为Stripe希望将其作为数字传递。 所以:

handler.open({
  ...
  amount: 100,
  ...
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM