相关疑难解决方法(0)

表单序列化javascript(没有框架)

想知道javascript中是否有一个函数没有jquery或任何允许我序列化表单并访问序列化版本的框架?

javascript forms serialization

118
推荐指数
12
解决办法
14万
查看次数

如何在Stripe nodejs库中正确创建'charge'?

客户

我正在使用Stripe Checkout自定义集成 - https://stripe.com/docs/checkout#integration-custom-以下列方式:

  var handler = StripeCheckout.configure({
    key: 'YOUR_KEY_HERE',
    image: 'images/logo-48px.png',
    token: function(token, args) {
        $.post("http://localhost:3000/charge", {token: token}, function(res) {
            console.log("response from charge: " + res);
        })
    }
  })
Run Code Online (Sandbox Code Playgroud)

使用自定义简单相反- 如何修改Stripe Checkout而不是发送AJAX请求?- 因为简单不允许我进行AJAX调用.

服务器

https://stripe.com/docs/tutorials/charges

您已获得用户信用卡详细信息的令牌,现在是什么?现在你向他们收钱.

app.post('/charge', function(req, res) {
    console.log(JSON.stringify(req.body, null, 2));
    var stripeToken = req.body.token;

    var charge = stripe.charges.create({
        amount: 0005, // amount in cents, again
        currency: "usd",
        card: stripeToken,
        description: "payinguser@example.com"
    }, function(err, charge) {
        if (err …
Run Code Online (Sandbox Code Playgroud)

node.js stripe-payments

11
推荐指数
1
解决办法
6955
查看次数