0

I am create my sandbox account for testing. I can perform payment successful but and I am also redirect to my success page but I cannot get TX parameter when success page is loaded.

I am pass return url in my form and I am also setting return URL in my PayPal account and also turn Payment Data Transfer, but I cannot get any parameter when success page is loaded.

BUY.PHP

<?php
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // Test Paypal API URL
$paypal_id='my-id-facilitator@gmail.com'; // Business email ID
?>
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='form1'>
<input type='hidden' name='business' value='Demo for paypal'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='demo'>
<input type='hidden' name='item_number' value='1'>
<input type='hidden' name='amount' value='1'>
<input type='hidden' name='rm' value='1'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='cancel_return' value='http://my-site.com/cancel.php'>
<input type='hidden' name='return' value='http://my-site.com/success.php'>
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">
</form>

SUCCESS.PHP

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

echo $item_transaction;
echo "<br>".$item_price;
echo "<br>".$item_currency;

?>
halfer
  • 19,824
  • 17
  • 99
  • 186
Paresh Gami
  • 4,777
  • 5
  • 23
  • 41
  • 1
    refer working example from http://www.phpgang.com/how-to-integrate-payment-system-with-paypal_249.html – user2706194 Aug 07 '14 at 12:59
  • The code seems to same – Paresh Gami Aug 07 '14 at 13:02
  • you had written and there is – user2706194 Aug 07 '14 at 13:05
  • In my paypal account one account is under business and other is under personal. there is problem? – Paresh Gami Aug 07 '14 at 13:05
  • @ user2706194 Trying not working – Paresh Gami Aug 07 '14 at 13:06
  • You are using Paypal IPN? If so you need to define in your paypal account an URL of a IPN script which handle your transaction. Return URL is usually used just to redirect a buyer back to your store or on thank you page or something like that. I used to know more about that but didnt use paypal for a while now :) – StudioArena Aug 07 '14 at 13:11
  • @StudioArena Yes i am set there my success page and also turn Payment Data Transfer – Paresh Gami Aug 07 '14 at 13:22
  • @PareshGami Check the `$_POST` variables. If you haven't enabled PDT properly then PayPal posts the data to your site. Do `var_dump($_POST);` in success.php and see what you get. If there is data from PayPal then check your account settings as you haven't enabled PDT properly. – Styphon Aug 07 '14 at 13:32
  • Check this answer maybe it will help you understand all together. http://stackoverflow.com/questions/10496672/paypal-subscriptions-pdt-ipn-please/10497817#10497817 – StudioArena Aug 07 '14 at 13:59
  • @StudioArena IPN is work for sandbox account or live account? – Paresh Gami Aug 08 '14 at 04:56
  • @StudioArena I set the return URL from login in paypal.com. I think we need to login in developer.paypal.com for set test return url. but there is i caanot see any web preference for setting for return url. – Paresh Gami Aug 08 '14 at 05:22
  • Newly created sandbox account have problem for getting transction details – Paresh Gami Aug 08 '14 at 09:31

0 Answers0