Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2checkout test payment simulation

In a php application of mine, I am looking for help on how to simulate test payment with https://www.2checkout.com/. I have experience with test payment for Paypal sandbox using developer account. But in here 2checkout I can't figure it out.

like image 736
ARIF MAHMUD RANA Avatar asked Dec 02 '22 21:12

ARIF MAHMUD RANA


1 Answers

With 2Checkout, you can place a demo sale by changing your demo account setting to "On" on the Site Management page in your 2Checkout account. Once this is set, you will see a message at the top of the checkout page stating that this is a demo sale. If your account is currently being used for live sales, you can place a demo sale by changing your demo account setting to "Parameter" and then pass in an additional "demo" parameter with a value of "Y". This way your live sales will not be interrupted.

Example:

https://www.2checkout.com/checkout/spurchase?sid=1303908&mode=2CO&li_0_type=product&li_0_price=1.00&li_0_quantity=1&li_0_name=Example+Product+Name&demo=Y

You should note that when placing demo sales the MD5 hash returned by 2Checkout is intentionally broken by computing the hash with a 1 for the order number so if you are checking against the hash your return script needs to handle this change.

Example:

<?php

if ($_REQUEST['demo'] == 'Y') 
{
    $order_number = 1;
}
else
{
    $order_number = $_REQUEST['order_number'];
}

$compare_string = $_REQUEST['secret_word'] . $_REQUEST['sid'] . $order_number . $_REQUEST['total'];
$compare_hash1 = strtoupper(md5($compare_string));
$compare_hash2 = $_REQUEST['key'];

if ($compare_hash1 != $compare_hash2)
{
    echo "Hash Mismatch";
}
else
{
    echo "Hash Matched";
}

INS messages are not sent on demo sales so if you are also utilizing the Instant Notification Service (INS), you can use the INS testing tool to simulate the INS messages you are listening for.

Please feel free to also contact [email protected] if you need assistance with testing your integration.

like image 110
Craig-2Checkout Avatar answered Dec 24 '22 06:12

Craig-2Checkout