php2checkout

Can't get custom parameter in 2checkout response


My Form code is as below. and added ramram as hidden input. I want to add my Order in this.

<form id="2checkout" action="https://sandbox.2checkout.com/checkout/purchase" method="post">
<input type="hidden" name="sid" value="901353720"/>
<input type="hidden" name="mode" value="2CO"/>
<input type="hidden" name="li_0_name" value="Test Product"/>
<input type="hidden" name="li_0_price" value="0.01"/>
<input type="hidden" name="ramram" value="512" />
<input type="submit" value="Click here if you are not redirected automatically" />
</form>
<script type="text/javascript">document.getElementById('2checkout').submit();</script>

and to get response i used following code

<?php

$html = '';
foreach ($_POST as $k => $v) {
    $html .= "$k => $v"; echo PHP_EOL;
}

file_put_contents('test.txt', $html); ?>

Solution

  • Use Specific name for it.

    For eg.

    <input type='hidden' name='merchant_order_id' value='51200' >

    for more Parameters

    ref. https://www.2checkout.com/documentation/checkout/standard-checkout