Tuesday 16 May 2017

Not able to get authorization on 2checkout

I am trying to authorize orders on the 2checkout sandbox, it was working fine but suddenly it stopped. Now I am always getting:

Payment Authorization Failed: Please verify your information and try again, or try another payment method.

var tco = new Twocheckout({
    sellerId: "1234456688", //on my code I am sending my true seller id                                  
    privateKey: "XXXXXXX-XXXXXX-XXXXXX", //on my code I am sending my key                              
    sandbox: true
  });

  var plan = SubscriptionService.getPlan(req.body.plan);
  if(plan) {

    var params = {
      "merchantOrderId": new Date().valueOf()+"",
      "token": req.body.token,
      "currency": "USD",
      "tangible": "N",
      "lineItems": [
        {
          "name": plan.name,
          "price": plan.price,
          "type": "product",
          "quantity": "1",
          "productId": plan.id,
          "recurrence": "1 Month",
          "duration": "Forever",
          "description": ""
        }],
      "billingAddr": {
        "name": req.body.ccName,
        "addrLine1": req.body.streetAddress,
        "city": req.body.city,
        "state": req.body.state,
        "zipCode": req.body.zip,
        "country": req.body.country,
        "email": req.user.email,
        "phoneNumber": "5555555555"
      }
    };


    tco.checkout.authorize(params, function (error, data) {
      if (error) {
        res.send(error);
      } else {
        res.send(data.response);
      }
    });
  }
}

this is the example of a json I am sending

{ merchantOrderId: '1494967223074',
  token: 'ZTFiNmFkMjktZWNmMi00NjlhLWE0MDAtZmJkMGJlYjU5M2Q1',
  currency: 'USD',
  tangible: 'N',
  lineItems:
   [ { name: 'pro plan',
       price: '149.00',
       type: 'product',
       quantity: '1',
       productId: '002',
       recurrence: '1 Month',
       duration: 'Forever',
       description: '' } ],
  billingAddr:
   { name: 'Testing Tester',
     addrLine1: '123 Main Street',
     city: 'Townsville',
     state: 'ohio',
     zipCode: '43206',
     country: 'USA',
     email: 'victor.eloy@landmarkwebteam.com',
     phoneNumber: '55555555' } }

If I go to my account >> site management and set demo to true I manage to get authorizations from the sandbox but the orders do not get logged to the sandbox. Previously even when the demo mode was off I managed to get the orders authorized but now I don't know what is happening.

here comes a log from one order: enter image description here



via Victor Ribeiro da Silva Eloy

No comments:

Post a Comment