Paypal php script won't work -
when try script payment successful when i'm redirected says has failed! do here!
index.php file
<?php $paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // test paypal api url $paypal_id='censoring paypal email'; // business email id ?> <div class="btn"> <form action="<?php echo $paypal_url ?>" method="post" name="frmpaypal1"> <input type="hidden" name="business" value="<?php echo $paypal_id ?>"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="item_name" value="phpgang payment"> <input type="hidden" name="item_number" value="1"> <input type="hidden" name="credits" value="510"> <input type="hidden" name="userid" value="1"> <input type="hidden" name="amount" value="10"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden" name="handling" value="0"> <input type="hidden" name="cancel_return" value="http://23.95.189.209/coen/test/cancel.php"> <input type="hidden" name="return" value="http://23.95.189.209/coen/test/success.php"> <input type="image" src="https://www.sandbox.paypal.com/en_us/i/btn/btn_buynowcc_lg.gif" border="0" name="submit" alt="paypal - safer, easier way pay online!"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_us/i/scr/pixel.gif" width="1" height="1"> </form> </div> </div> <?php $title = "paypal payment in php"; $heading = "welcome paypal payment php example."; ?> success.php file
<?php $item_no = $_request['item_number']; $item_transaction = $_request['tx']; // paypal transaction id $item_price = $_request['amt']; // paypal received amount $item_currency = $_request['cc']; // paypal received currency type $price = '10.00'; $currency='usd'; //rechecking product price , currency details if($item_price==$price && $item_currency==$currency) { echo "successful payment"; } else { echo "failed payment"; } ?> im not sure why won't work! business email id own have taken out here though.
Comments
Post a Comment