0

I am using 2checkout.i have use the redirect url for success message but how can i get the error message and what are the error message that can be occur after completion of all the requirements.

1 Answers1

0

If you are using 2Checkout's hosted standard or inline checkout, and authorization failure will result in the failure message being displayed to the buyer so that they can correct the details and resubmit. A passback will only be sent to your approved URL when the authorization is successful.

If you are using the 2Checkout Payment API, the error JSON response will be returned to your server.

PHP Example:

Twocheckout::privateKey('BE632CB0-BB29-11E3-AFB6-D99C28100996');
Twocheckout::sellerId('901248204');
// Twocheckout::sandbox(true);  #Uncomment to use Sandbox

try {
    $charge = Twocheckout_Charge::auth(array(
        "merchantOrderId" => "123",
        "token" => 'Y2U2OTdlZjMtOGQzMi00MDdkLWJjNGQtMGJhN2IyOTdlN2Ni',
        "currency" => 'USD',
        "total" => '10.00',
        "billingAddr" => array(
            "name" => 'Testing Tester',
            "addrLine1" => '123 Test St',
            "city" => 'Columbus',
            "state" => 'OH',
            "zipCode" => '43123',
            "country" => 'USA',
            "email" => 'testingtester@2co.com',
            "phoneNumber" => '555-555-5555'
        ),
        "shippingAddr" => array(
            "name" => 'Testing Tester',
            "addrLine1" => '123 Test St',
            "city" => 'Columbus',
            "state" => 'OH',
            "zipCode" => '43123',
            "country" => 'USA',
            "email" => 'testingtester@2co.com',
            "phoneNumber" => '555-555-5555'
        )
    ), 'array');
    if ($charge['response']['responseCode'] == 'APPROVED') {
        echo "Thanks for your Order!";
    }
} catch (Twocheckout_Error $e) {
    $e->getMessage();
}

Please reach out to 2Checkout tech support at techsupport@2co.com if you would like further assistance with your sandbox testing.

Craig-2Checkout
  • 741
  • 5
  • 7