0

I tried this same call with Sandbox and it worked well. When I changed to Production (live) 2CO only returns "Bad Parameters".

Do I need to setup one more thing in 2CO account? Every example I found at the insert use the same kind of call.

What am I doing wrong?

My Code:

Twocheckout::privateKey(MYKEY); //Private Key
Twocheckout::sellerId(MYID); // 2Checkout Account Number
Twocheckout::sandbox(false); // Set to false for production accounts.

try {
    $charge = Twocheckout_Charge::auth(array(

        "sellerId" => "MYID",
        "merchantOrderId" => "1",
        "token"      => $_POST['token'],
        "currency"   => "USD",
        //"total" => "1.00",           //Only use when lineitems are not passed in
        "lineItems" => array(
            "0" => array(  
                    "type" => 'product',
                    "price" => "1.00",
                    "productId" => "0000001",
                    "name" => "Smartphone Chip",
                    "quantity" => "1",
                    "tangible" => "N",
                    "description" => "Description of my product"
                    )
                ),
        "billingAddr" => array(
            "name" => $Nome,
            "addrLine1" => $Endereco . ' ' . $Numero . ' ' . $Complemento . ' ' . $Bairro,
            "city" => $Cidade,
            "state" => $Estado,
            "zipCode" => $CEP,
            "country" => 'BRA',
            "email" => $Email,
            "phoneNumber" => $DDD . $Celular
        ),
        "shippingAddr" => array(
            "name" => $Nome,
            "addrLine1" => $Endereco . ' ' . $Numero . ' ' . $Complemento . ' ' . $Bairro,
            "city" => $Cidade,
            "state" => $Estado,
            "zipCode" => $CEP,
            "country" => 'BRA',
            "email" => $Email,
            "phoneNumber" => $DDD . $Celular
        )       
    ));


    if ($charge['response']['responseCode'] == 'APPROVED') {
      echo "Success!";
    }

} catch (Twocheckout_Error $e) {

    print_r($e->getMessage());

    exit();
}
Natalie Hedström
  • 2,607
  • 3
  • 25
  • 36
Canuto
  • 1
  • 1

1 Answers1

0

Your Live account should be verified (Not in Demo Mode) for this to work.