Hassan Ali
Hassan Ali

Reputation: 593

2Checkout - curl failed error sandbox

<?php

require "lib/Twocheckout.php";

Twocheckout::privateKey('E33E09ED-BD17-4775-AF92-27DE266859A6'); 
Twocheckout::sellerId('901275831'); 
Twocheckout::sandbox(true);

try {
    $charge = Twocheckout_Charge::auth(array(
        "merchantOrderId" => "123",
        "token"      => $_POST['token'],
        "currency"   => 'USD',
        "total"      => '10.00',
        "billingAddr" => array(
            "name" => 'Joe Flagster',
            "addrLine1" => '123 Main Street',
            "city" => 'Townsville',
            "state" => 'Ohio',
            "zipCode" => '43206',
            "country" => 'USA',
            "email" => '[email protected]',
            "phoneNumber" => '555-555-5555'
        )
    ));

    if ($charge['response']['responseCode'] == 'APPROVED') {
        echo "Thanks for your Order!";
        echo "<h3>Return Parameters:</h3>";
        echo "<pre>";
        print_r($charge);
        echo "</pre>";

    }
} catch (Twocheckout_Error $e) {
    print_r($e->getMessage());
}

?>

I am using a test sample data: Sample Test Data

My Seller id: 901275831

What to do now? I am testing it for the first time. but don't know why this error is occurring. Is there anyone can help?

Upvotes: 1

Views: 1184

Answers (1)

Hassan Ali
Hassan Ali

Reputation: 593

by adding this:

// If you want to turn off SSL verification (Please don't do this in your production environment)
Twocheckout::verifySSL(false);  // this is set to true by default

it got working on localhost.

Upvotes: 4

Related Questions