1
votes

im using paypal sandbox testing buyer and seller accounts. using these seller account to integrate paypal payment gateway. after payment successful it should automatically redirect to the success page. here is the code im using

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<form name='_xclick' target='_parent' action='https://www.sandbox.paypal.com/webscr' method='post'>


        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="[email protected]">
        <input type="hidden" name="currency_code" value="USD">
        <input type="hidden" name="item_name" value="Invoice payment">
        <input type="hidden" name="return" value="http://www.mysite.com/success.php/">


                   <input type="hidden" name="amount" value="12">

   <input type='subimit' name='submit' value='pay by paypal'>
    </form>  

also i have turned ON Auto Return for Website Payments in paypal seller settings. How to pass the transaction id to success.php. what code should be written in success.php page... and also if the transaction is suucessfull i have to update the amount in the database else failure amount should be update in database... can anyone help me out.

1

1 Answers

0
votes

on success page you simply get data

$item_transaction = $_GET['tx']; // Paypal transaction ID
$item_price = $_GET['amt']; // Paypal received amount
$item_currency = $_GET['cc']; // Paypal received currency type