要在创建付款时结帐,会出现此错误"错误请求 - 参数错误"

时间:2014-12-07 10:01:38

标签: node.js payment-gateway 2checkout

创建付款时,此错误会显示“错误请求 - 参数错误”,如下所示。我定义了所有结帐配置。请任何人有这个问题或有这个问题的想法

    var params = {
        "merchantOrderId": "123",
        "token": "MWQyYTI0ZmUtNjhiOS00NTIxLTgwY2MtODc3MWRlNmZjY2Jh",
        "currency": "USD",
        "total": "10.00",
        "billingAddr": {
            "name": "Testing Tester",
            "addrLine1": "123 Test St",
            "city": "Columbus",
            "state": "Ohio",
            "zipCode": "43123",
            "country": "USA",
            "email": "example@2co.com",
            "phoneNumber": "5555555555"
        }
    };

    // Make the call using the authorization object and your callback function
    tco.checkout.authorize(params, function (error, data) {
        if (error) {
            console.log('error ',error.message);
        } else {
            console.log('success ',JSON.stringify(data));
        }
    });

2 个答案:

答案 0 :(得分:0)

    var Twocheckout = require('2checkout-node');

    var tco = new Twocheckout({
        apiUser: "your_username",                              
        apiPass: "your_password",
        sellerId: 'your_seller_id',                             
        privateKey: "your_private_key",
        demo: true,
        sandbox: true
    });

    var params = {
            "merchantOrderId": "001",
            "token": "gener",
            "currency": "USD",
            "total": "10.00",
            "billingAddr": {
                "name": "Testing Tester",
                "addrLine1": "123 Test St",
                "city": "Columbus",
                "state": "Ohio",
                "zipCode": "43123",
                "country": "USA",
                "email": "example@2co.com",
                "phoneNumber": "5555555555"
            }
        };

   tco.checkout.authorize(params, (error, data) => {

      if (error) {
        return res.status(401).end()
      } else {
        return res.json(data)
        console.log(JSON.stringify(data));
      }

    });

每次新转换生成令牌generate token

答案 1 :(得分:0)

由于以下原因导致错误Bad request - parameter error

  1. 您的帐户尚未获得2Checkout当局的批准
  2. 您已被2Checkout阻止