Paypal Payment need transactions details - php

I have used paypal payment form submission but in response we didn't get payment status and transactions detail we just geting payer_status.
My code is below:
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="currency_code" value="AUD" >
<input type="hidden" name="rm" value="2" >
<input type="hidden" value="" name="custom" id="custom" />
<input type="hidden" name="invoice" value="" >
<input type="hidden" name="item_name" value="">
<input type="hidden" name="a3" value="" >
<input type="hidden" name="p3" value="" >
<input type="hidden" name="t3" value="" >
<input type="hidden" name="src" value="1" >
<input type="hidden" name="sra" value="1" >
<input type="hidden" name="return" value="xx">
<input type="hidden" name="cancel_return" value="xx">
<input type="hidden" name="no_shipping" value="1" >
Let me know any solution to get transaction details.

For getting paypal transaction details do follow steps :
Auto Return should be "ON" for getting transaction detail via paypal account.
a: Login to your paypal account .
b: Then go to your profile -> myselling tool ->website preference
c: Click on the auto return button make it "ON".
d: And give the return url link on this page .(In my case my app return url is success.php)
2.When Payment will be successfully completed then provide $_REQUEST array which contains product id, PayPal transaction ID, PayPal received amount value, PayPal received currency type and PayPal product status.
and write this code to your success.php page.
if (!empty($_REQUEST)) {
$product_no = $_REQUEST['item_number']; // Product ID
$product_transaction = $_REQUEST['tx']; // Paypal transaction ID
$product_price = $_REQUEST['amt']; // Paypal received amount value
$product_currency = $_REQUEST['cc']; // Paypal received currency type
$product_status = $_REQUEST['st']; // Paypal product status
}
I hope this clears up the paypal transactions details.

Related

paypal website form return parameters with link and auto return

I choose "on" for auto return from my selling tools:
https://www.paypal.com/webapps/customerprofile/
But auto return is not working! why?
and this my form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="example#mail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="<?php echo $name; ?>">
<input type="hidden" name="item_number" value="<?php echo $id; ?>">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="return" value="http://example.com/done.php">
<input type="hidden" name="cancel_return" value="http://example.com/cancel.php">
<input type="submit" name="submit" value="Buy">
</form>
now my return page not has parameters like this:
http://example.com/done.php?tx=XXXX&st=Completed&amt=200.00&cc=USD&cm=&item_number=7
I need auto return and paramteres!
Help me.
Most Likely, you did not enable Payment Data Transfer(PDT).
You enabled PDT, but if transaction is made via Credit card, you will need to manually click on "return to merchant site" link to get redirected
to your return URL which means auto-return only works if payment is made via paypal account.
Steps to enable PDT
-Login to your PayPal account
-click on Profile
-click 'My selling preferences
-click on Update next to Website preferences
-Go to the Payment Data Transfer Section
-Choose Payment Data Transfer ON and the Token will be displayed below
PDT Sample codes

paypal recurring payment pending status?

I have been searching and reading up about this issue for hours now and I do not have a clue why no one has an answer to this apart from changing the provider etc which is not wanted.
I also found this Paypal Sandbox recurring payment with initial amount pending
which is the exact same issue that i have right now and there seems to be someone called "PayPal_Patrick " who replied to that question but they've removed all their comments for some reason!
any way, I am just trying to figure out why the first initial paypal recurring payment shows as pending!
I get the IPN response and my IPN enters the data into mysql database as it should but the payment status shows as pending!
when I look into the paypal sandbox account, I see the payment status as pending too. so there must be something that stops the paypal to create the recurring profile immediately!
here is my simple form that will allow the user to create a recurring payment:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="mysandboxemail#gmail.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="cbt" value="Return to The Store">
<input type="hidden" name="cancel_return" value=" <?php echo $actual_link ?>">
<input type="hidden" name="custom" value="This is a custom field!!!">
<input type="hidden" name="item_name" value="ACCOUNT UPGRADE">
<input type="hidden" name="a3" value="5.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
could someone please help me out with this issue?
Thanks
Here it is for future reference:...
All you have to do is to change the settings of your Paypal account so it accepts payment from all currencies.

Passing values or variables over to paypal cart

I am developing a website so that a customer can buy gardening products. Currently, a customer can browse products on the website. When they select an individual product, I want them to be able to add to cart using Paypal's custom button. My website is set up so that when a user selects a product, it grabs the information from the database. What do I need to do in order for the product they have added to cart to appear in the Paypal cart? (with its name, and price).
From what I understand, you have to create each individual button for each item on your website. But I do not know what product the customer has selected from the database and my website is set up so that it retrieves the product info from the db.
Hope somebody could help me
A single button can use different products , you must be in a loop. But hidden params would be different.
<input type="hidden" value="Scicssors" name="item_name">
<input type="hidden" value="return.php" name="notify_url">
<input type="hidden" value="10.00" name="amount">
...........................................
There are more than fields required to pass as hidden. You can send these along with form submission button
Refer this link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
You can use a single button for all products. You can change the item_name and amount depending upon the product selected. You can pass userid in item_number field.
When a customer selects the product, query to the database and fetch the product name and amount and update it to the hidden fields.
<?php
$amt = amt from db;
$name = product name from db;
$userid = user's id;
?>
<form name=subs action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<table cellspacing=0 cellpadding=0><tr><td>
<input type="hidden" name="on0" value="user">
<input type="hidden" name="os0" value="<?php echo $user_email; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales#yoursite.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="add">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://yoursite.com/payment-success.php"> //return to this url after payment completed
<input type="hidden" name="cancel_return" value="http://yoursite.com/payment-cancel.php"> //return to this url when payment cancelled
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="CustomValue">
<input type="hidden" name="notify_url" value="http://yoursite.com/payment-confirm.php"> //return instant payment notification to this url where you can get the response from paypal and process it
<input type="hidden" name="event" value="add">
<input type="hidden" name="mnt" value="0">
<input type="hidden" name="amount" value="<?php echo $amt; ?>" id="paypalamt"> //the product's amount
<input type="hidden" name="item_number" id="paypalno" value="<?php echo $userid; ?>"> //you can send the customer/user id with this, so that you can retrieve it after payment completion
<input type="hidden" name="item_name" id="itemname" value="<?php echo $name; ?>"> //here you can set your product name
</td></tr>
</form>

Send values of item to paypal cart [duplicate]

I am developing a website so that a customer can buy gardening products. Currently, a customer can browse products on the website. When they select an individual product, I want them to be able to add to cart using Paypal's custom button. My website is set up so that when a user selects a product, it grabs the information from the database. What do I need to do in order for the product they have added to cart to appear in the Paypal cart? (with its name, and price).
From what I understand, you have to create each individual button for each item on your website. But I do not know what product the customer has selected from the database and my website is set up so that it retrieves the product info from the db.
Hope somebody could help me
A single button can use different products , you must be in a loop. But hidden params would be different.
<input type="hidden" value="Scicssors" name="item_name">
<input type="hidden" value="return.php" name="notify_url">
<input type="hidden" value="10.00" name="amount">
...........................................
There are more than fields required to pass as hidden. You can send these along with form submission button
Refer this link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
You can use a single button for all products. You can change the item_name and amount depending upon the product selected. You can pass userid in item_number field.
When a customer selects the product, query to the database and fetch the product name and amount and update it to the hidden fields.
<?php
$amt = amt from db;
$name = product name from db;
$userid = user's id;
?>
<form name=subs action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<table cellspacing=0 cellpadding=0><tr><td>
<input type="hidden" name="on0" value="user">
<input type="hidden" name="os0" value="<?php echo $user_email; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales#yoursite.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="add">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://yoursite.com/payment-success.php"> //return to this url after payment completed
<input type="hidden" name="cancel_return" value="http://yoursite.com/payment-cancel.php"> //return to this url when payment cancelled
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="CustomValue">
<input type="hidden" name="notify_url" value="http://yoursite.com/payment-confirm.php"> //return instant payment notification to this url where you can get the response from paypal and process it
<input type="hidden" name="event" value="add">
<input type="hidden" name="mnt" value="0">
<input type="hidden" name="amount" value="<?php echo $amt; ?>" id="paypalamt"> //the product's amount
<input type="hidden" name="item_number" id="paypalno" value="<?php echo $userid; ?>"> //you can send the customer/user id with this, so that you can retrieve it after payment completion
<input type="hidden" name="item_name" id="itemname" value="<?php echo $name; ?>"> //here you can set your product name
</td></tr>
</form>

paypal ipn passing parameter

I wanted to get the userid from paypal after the user have made his payment.
Pay.php
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $merchant_email ?>">
<input type="hidden" name="item_name" value="IPN test">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="notify_url" value="<?php echo $ipn_url ?>">
<input type="hidden" name="return" value="<?php echo $return_url ?>">
<input type="hidden" name="cancel_return" value="<?php echo $cancel_url ?>">
<input type="hidden" name="userid" value="888">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif"
border="0" name="submit" alt="Buy Now">
So I would enable ipn in my paypal account and point to http://www.domain.com/ipn.php?
In ipn.php code
<?php
$userid = $_POST['userid'];
$qry = "INSERT into mypayments(userid) VALUES ('$userid') “;
$result = mysql_query($qry,$db);
?>
Is it correct? How do I get VERIFIED from paypal?
I believe that userid is an incorrect name and will not be returned in your IPN message. I use the optional fields for passing IDs and stuff needed for processing the transaction on my end.
These optional tags are on0, on1, or on3 for the custom field names and os0, ls1, and os2 for the custom field values. These values can go up to on6 and os6.
I would send on0 with a value of "UserID" and os0 the actual ID.
These values will be represented in the IPN as follows:
os0 is represented as option_selection1
os1 is represented as option_selection2
os2 is represented as option_selection3
on0 is represented as option_name1
on1 is represented as option_name2
on2 is represented as option_name3
Here's the info on PayPal's HTML parameters
Use the "custom" variable.
<input type="hidden" name="custom" value="user_id" />
Its a two step process.
PayPal will post an IPN to the url you specified in $ipn_url.
You will then get a VERIFIED response when you post all of the IPN data with an additional cmd=_notify-validate param (details) back to PayPal.
PHP sample here.

Categories