php - Run function only after paypal transaction success and redirected to my page -


i building page items gonna sell through paypal. first did generic buttons fixed prices,after clicking redirected paypal page values that:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" class="paypalbtn"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="test@gmail.com"> <input type="hidden" name="item_name" value="test"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="amount" value="10.00"> <input type="hidden" name="bn" value="pp-buynowbf:btn_buynowcc_lg.gif:nonhostedguest"> <input type="image" src="https://www.paypalobjects.com/he_il/il/i/btn/btn_buynowcc_lg.gif" border="0" name="submit" alt=""> <img alt="" border="0" src="https://www.paypalobjects.com/en_us/i/scr/pixel.gif" width="1" height="1"> </form> 

but dangerous because client can change amount value...and can make problems. chose using api - means, on server side sending values price,amount... ang getting token id. after sending again data, , in end payment transferred , every thing closed. 1 of parameters is: $paypalreturnurl , page after success result, user redirected to.

now after did , verified payment pass want start private program private function (each time run it cost me money) should done once, after payment passed. page redirect example : payment.php, , there start function.

the question is: how can sure user wont go straight php address , automatically start function. options guarantee function run once after paypal redirect me.

you making complex. here how did paypal integration.

alone input price send transaction no in hidden field below.

<input type="hidden" name="amount" value="10.00"> <input type="hidden" name="tx_id" value="1234"> 

before generation form insert database record status of transaction pending below.

tx_id = 1234 amount = 10.00 tx_status = 0 // pending 

when transaction complete paypal return amount, tx_id , status of transaction. using select query can check whether returned amount same amount whether in database table.

select amount table_name tx_id = 1234 

then if it's correct change tx_status paid. else mark fraud.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -