9lessons programming blog
Loading Search
9lessons Bring Friends
Wall Script
Follow Me:
Monday, March 14, 2011

Payment System with Paypal

I received a tutorial requests from my reader that asked to me how to implement payment gateway system with Paypal API. In this post I want to explain how to work with Paypal Sandbox test accounts for payment system development and sending arguments while click buy now button. It’s simple and very easy to integrate in your web projects.

Payment System

Download Script     Live Demo

Sample database design for Payment system. Contains there table users, products and sales.
Payment process database design

Users
CREATE TABLE `users` (
`uid` int(11) AUTO_INCREMENT PRIMARY KEY,
`username` varchar(255) UNIQUE KEY,
`password` varchar(255),
`email` varchar(255) UNIQUE KEY,
)

Products
CREATE TABLE `products`
(
`pid` int(11) AUTO_INCREMENT PRIMARY KEY,
`product` varchar(255),
'product_img` varchar(100),
`price` int(11),
`currency` varchar(10),
 )

Sales
CREATE TABLE `sales`
(
`sid` int(11) AUTO_INCREMENT PRIMARY KEY,
`pid` int(11),
`uid` int(11),
`saledate` date,
`transactionid` varchar(125),
FOREIGN KEY(uid) REFERENCES users(uid),
FOREIGN KEY(pid) REFERENCES products(pid)
)


Step 1
Create a Paypal Sandbox account at https://developer.paypal.com/

Step 2
Now create test accounts for payment system. Take a look at Sandbox menu left-side top Sandbox->Test Accounts
Creating Paypal Test Account

Step 3
Here I have created two accounts Buyer (personal) and Seller (merchant/business)
Paypal test accounts

products.php
Contains PHP code. Displaying records from products table product image, product name and product price. Here you have to give your business(seller) $paypal_id id. Modify paypal button form return and cancel_return URLs.
<?php
session_start();
require 'db_config.php';
$uid=$_SESSION['uid'];
$username=$_SESSION['username'];
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // Test Paypal API URL
$paypal_id='your_seller_id'; // Business email ID
?>

<body>
<h2>Welcome, <?php echo $username;?></h2>
<?php
$result = mysql_query("SELECT * from products");
while($row = mysql_fetch_array($result))
{
?>
<img src="images/<?php echo $row['product_img'];?>" />
Name: <?php echo $row['product'];?>
Price: <?php echo $row['price'];?>$
// Paypal Button 
<form action='<?php echo $paypal_url; ?>' method='post' name='form<?php echo $row['pid']; ?&gt;'>
<input type='hidden' name='business' value='<?php echo $paypal_id; ?>'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='<?php echo $row['product'];?>'>
<input type='hidden' name='item_number' value='<?php echo $row['pid'];?>'>
<input type='hidden' name='amount' value='<?php echo $row['price'];?>'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='cancel_return' value='http://yoursite.com/cancel.php'>
<input type='hidden' name='return' value='http://yoursite.com/success.php'>
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">
</form>


<?php
}
?>
</body>

success.php
Paypal payment success return file. Getting Paypal argument like item_number. Paypal data success.php?tx=270233304D340491B&st=Completed&amt=22.00&cc=USD&cm=&item_number=1
<?php
session_start();
require 'db_config.php';
$uid = $_SESSION['uid'];
$username=$_SESSION['username'];
$item_no = $_GET['item_number'];
$item_transaction = $_GET['tx']; // Paypal transaction ID
$item_price = $_GET['amt']; // Paypal received amount
$item_currency = $_GET['cc']; // Paypal received currency type

//Getting product details
$sql=mysql_query("select product,price,currency from producst where pid='$item_no'");
$row=mysql_fetch_array($sql);
$price=$row['price'];
$currency=$row['currency'];

//Rechecking the product price and currency details
if($item_price==$price && item_currency==$currency)
{

$result = mysql_query("INSERT INTO sales(pid, uid, saledate,transactionid) VALUES('$item_no', '$uid', NOW(),'$item_transaction')");
if($result)
{
echo "<h1>Welcome, $username</h1>";
echo "<h1>Payment Successful</h1>";
}
}
else
{
echo "Payment Failed";
}
?>

Positive approach


cancel.php
Paypal API cancel_return file.
<?php
session_start();
$username=$_SESSION['username'];
echo "<h1>Welcome, $username</h1>";
echo "<h1>Payment Canceled</h1>";
?>

Negative approach


Step 4
When your web application test payment system workflow is completed. Change the form action development API URLs to original API URLs and give valid $paypal_id seller email id.
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr';
to
$paypal_url='https://www.paypal.com/cgi-bin/webscr';

Comments
{ 168 comments }
ghprod said...

nice, i have some project that needed to integrate with PP, and you make this tuts :)

great :)

Anonymous said...

nice !! :-) ... you are a genius ... you always make complicated things easier ...

Actual Soft Solutions said...

How we can get the commission for each sales.. mean if some one sells any products using my website i need to take 5% from the total amount of the product. How it can be done in Paypal. so that 5% amount is automatically transferred to my paypal account.

Jirawatee said...

Well done. Thank you guy.

Sreevathsa said...

Hi srini, nice tute as usual..:) is creating test account on paypal free or payable?

Dan said...

Srinivas, I'm curious about your database graph. What do you use when designing databases?

Norant said...

Hey Great tutorial, Srinivas, thank you from PerĂº.

Anonymous said...

Omg.... Asians rock!

dskanth said...

Great post Srinivas... we like these kind of innovative posts. Thanks a lot.

Anonymous said...

SQL Injection, no verification that a call to success.php actually came from PayPal (and is valid)...words fail me.

jacinto said...

this tutorial ROCKS! thank you very much dude :D

Srinivas Tamada said...

@Dan Mysql Workbench for database ER diagrams.

terusbelajar said...

waw..thanks for sharing Srinivas..:)

Anonymous said...

You have a big logical error in your code. You don't check what your code in success.php called from PayPal. Anyone can create html file (at the his own PC) with code like next:
<--FORM action="yoursite/success.php">
<--input type="text" name="item_number" value="Item1">
<--input type="submit"><--/FORM>.
This code calls to your page success.php and send there "item_number=Item1". And your page thinks what PayPal payment is accepted. But operation performed without PayPal.

mobikwik said...

thanks for sharing, paypal API is actually pretty complicated because there are too many options. We faced these issues while doing the integrations for http://www.mobikwik.com

Ashish said...

hi,

i tried your code and it worked fine for me, the only error i got is i am not getting the product id after successful transaction and getting "Payment Error" while inserting record in database...

Anonymous said...

Hey Srini,
i got the same error like ashish...

Anonymous said...

Nice post. I solved my problem very well.

Thanks

Anonymous said...

very nice

Srinivas Tamada said...

Modified 'success.php' file code. Re-checking the product price and currency details

Sreevathsa said...

hi srini, my question is .. in step 1 we need to register for the sandbox account.. is it paid account ??

Srinivas Tamada said...

@Sreevathsa

It's free just test account

kuldeep singh sadioura said...

hey Sri its not TEXT ACCOUNT its TEST Brother I think a little typo mistake is there.. :)

Anonymous said...

i am confused - cant anyone just call the success.php page and post sales? Usually I would assume you need to use PayPal IPN or something - its a good example but I am not sure if this is practical?

Al said...

For me its not safe, also the return url dont have transaction id for me.

saideep said...

Very Handy tuts :)

anton said...

item_number. Paypal data success.php?tx=270233304D340491B&st=Completed&amt=22.00&cc=USD&cm=&item_number=1

what $_GET[???], is Quantity???

Pawan Sharma said...

its post is nice but why are you using IPN for update database.

KOKARAT said...

Please advice how to use this tutorail to protect digital file. if success able to download file if not protected digital file.

rkl said...

Hi. Thanks for the tutorial. Everything works fine, except the redirection to the success page after the payment. Paypal doesn't redirect, it only confirms the payment and shows a link: Back to Robert Kleinert's Teststore. When I click on that link Paypal redirects to success.php?merchant_return_link=Back+to+Robert+Kleinert's+Test+Store

Whats the problem here? Or is it only a sandbox problem?

Thanks.

rikoy said...

nice info..

Nguyen Hai dang said...

Dear Srinivas Tamada,

i have downloaded import database o.k, tested o.k all, only url of success it still success.php not added more params. did you shared not enought code ? please check. i'm trying with ipn and use curt of php to test with more code.

Anonymous said...

Same with Nguyen Hai Dang

Srinivas Tamada said...

Sanbox new accounts success redirection problem.

Igor Azevedo said...

It was helpfull for me, however I think it is insecure to rely just on the data sent to the success.php file to verify the sale.

I added a field named 'verified' to the Sales table which defaults to '0'.
I then created a ipn.php file that is called by Paypal once the payment is received. This file then searches for the correct transactionid already on the table and changes the value of 'verified' to '1'.

This way you know the payment is legit because it's confirmed by Paypal itself. Otherwise people can just call the success.php directly and insert fake payments.

I think that having this is enough to make the process secure. Do you guys know of anything else I might be missing?

Igor Azevedo said...

@Nguyen Hai dang

I had the same issue, add this to the process form:
input type='hidden' name='return_method' value='2'

This defines the method that is used to pass the params to success.php (1=GET, 2=POST). I think GET is the default but it wasn't working for me so I changed to POST and it now receives the data.

chitra said...

Hi,
Can you Please tell is there any script which can convert smarty files to core php files instead of doing manually it is taking lot of time to change the code manually.If you have any solution Please let me know soon.........

waiting for your response.........

dskanth said...

I tried this demo.. working well, but when i tried the downloaded code, and customised it with my own details, i see that the payment is done.. but when it comes back to success.php, there is no parameter passed, and i receive the message: Payment Failed. Could not understand what is wrong.

Srinivas Tamada said...

@dskanth

Paypal Sanbox creating some problem with new registration accounts. Success page not redirecting well try to use my test merchant email.

ekkis said...

thank you from LA. great tutorial!

ekkis said...

thanks from LA!

koelho said...

Awsome tutorial it wrks in my web, buti need to pay several products but it only sends one, how can i do it?

Webn3t.com said...

Man I Love your Blog its fantastic what you explain here im not well in english language but everything is clearly for me thanks for this blog man.

Anonymous said...

hi dear Srinivas Tamada
its very use full tutorial for me thanks but i am having problem on succes.php page because when its return from paypal page it show me payment failed and data also not inserting in database please do tell me the solution as soon as possible i am waiting. thanks

Asif said...

and i want to know that if a user buy shirt on index page i will show him 0 value but when he came back after payment i want to show value 1 how it will done please tell

Asif said...

will you please tell me how it will done??
i want to show a "0" value in label when user comes first time on my site and after payment through paypal when he or she back on my site on i want to show a value "1" in label kindly help me as soon as posible
thanks

Anonymous said...

Maybe must add feature to download product and expired download link..

Thanks

ashutosh Mishra said...

Hi,

Nice tutorial it work properly when i set my return url: http://demos.9lessons.info/paypal/success.php.
But when i change it with my url for ex:
return url: http://localhost/paypal/success.php.

it not work properly i am also not getting any item_no value on the success.php file when i echo the query :
"select product,price,currency from producst where pid='$item_no'"
it give pid=''

what is the problem .
Please provide me a solution for it.

ashutosh Mishra said...

Hi Srinivas,

i send a feed back to you regarding this tutorial . It was my mistake. It working fine with your $paypal_id ='sriniv_1293527277_biz@inbox.com' but when i use my pay pal id marut_1321421584_biz@1solutions.biz

It not work properly what is the issue. Can anything we do in my pay-pal sand box account setting.

in this case we not get item_number and amt and all other thing what is the problem .

Please provide me the solution for it.

My mail id is marut0210@gmail.com

Anonymous said...

Hi, In my case, the user is not redirected back to my website after payment is completed. Is there another back end soluction to get notified of a transaction? I'm trying to configure IPN but I cannot find it on sandbox anymore.

Anonymous said...

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\paypal\success.php on line 15
Payment Failed

sakkona said...

hi, Srinivas thanks for your tutorial.
it's great for me. First of all i had been the problem as @ashutosh Mishra too. now i can find the solution to redirect to the success.php page.
1. log in into Business mail
2. click on profile
3. Website payment preferences
in that, configure some points:
set Auto Return to On and type return URL address (e.g. http://localhost/paypal/success.php)
set Payment Data Transfer to On

I'm sorry if my English made you misunderstand.

CrazyArun said...

really good to see this blog...
I need one help from how can i create test account for money booker payment gateway..

rahul said...

hi,i used your code but after transaction,i did not get any txnid,amount will you plz help me..i got message payment failed....

Anonymous said...

Hi

In my PayPal sandbox account, when I click "Pay Now" it display a link "Return to my Test Store".
But I want sandbox get the process of auto return.
Can we do this with PayPal Sandbox?

Anonymous said...

@ Srinivas,

I follow your code already. after user payed, the paypal did not redirect to my website so I can not get the transactionID, amount...

I tested with sanbox. Please help me.

Seyha Chroeng said...

Hi Srinivas,

It works fine with your $paypal_id ='sriniv_1293527277_biz@inbox.com' but when i use my email It not work properly what is the issue.
How can I get the paypaID? Do I need to config with paypal account setting?

Please provide me the solution with this problem.

Srinivas Tamada said...

Hi Seyha

Paypal sandbox updated new sample biz id not redirecting properly.

Muhammad Sajid said...

Hi, I used it but it live for Paypal Send box but it only show
Thanks for your order page of Paypal, not redirect to success.php and therefore does not insert record into sales table.

Khaled Javeed said...

Hi, your code helped me to start my code with.
Facing a problem! What if a user clicks some other link (like: show my account details); our site will not be notified about payment and the payment will b deducted from user account and credited to store account. BUT our database will have no entry against it.
Any solution??

Anonymous said...

OMG, you save my time, thanks. love this tutorial.

Anonymous said...

Hi Srinivas Tamada,
I 'm Ok all of the steps,but in success.php it show me "Payment Failed" and it does not save sales table. Why? . That's a problem and please explain it. Thanks in advance.

Gaurav Bansal said...

Hi!
so the redirection problem is there in the sandbox accounts

but is the redirection problem also in the real accounts...

can some confirm this..

@Srinivas: awesum blog... really helped..
\m/

Anonymous said...

Hi Srinivas,

when i used your paypal id , paypal will redirect to success page(all working fine) but when i use my paypal id it's not redirect! so how to update my database?

Anonymous said...

When I do this, and paypal returns to the return url it does not post the info to the url like this "success.php?tx=270233304D340491B&st=Completed&amt=22.00&cc=USD&cm=&item_number=1"
it just goes to "success.php" why is that?

desipreneur said...

@Gurav, this is something I also want to know

NiRaJ (asp or php)!!!!!! said...

Is it possible to pay the amount to two account at a single time?

I mean to say that when a person pays amount then his amount will be divided in two parts 95% of amount to the actual payment receiver and 5% to a default user(me).

Anonymous said...

need to explain more clearly dear

Anonymous said...

I am getting the following error
This recipient is currently unable to receive money
What should i do

Anonymous said...

Hay First of all thanks dude...
I try your demo code and its work properly but in final step i can't redirect on sucess.php pls replay fast...

Thanks again..

sabarivasan said...

Hi Srinivas Tamada,thank u for update
I 'm Ok all of the steps,but in success.php it show me "Payment Failed" and it does not save sales table. Why? . That's a problem and please explain it. Thanks in advance.

nikunj said...

nice work.......

Nate said...

Is there anyway to make it auto-redirect to the success page? Right now, the only way for their purchase to be added to the database is IF they actually click return to the website.

Nate said...

I actually figured out the previous redirect issue, needed to change something in my paypal settings. Now I am noticing none of the parameters are sent with the success.php so all of the info being input into the database is blank or 0. Any way to fix this so it gets the actual data?

Anonymous said...

Awesome!!!!! I never see on the web like this..!

Anonymous said...

It's excellent Srinivas.

@Nate:

Auto Return is turned off by default.
To turn on Auto Return:

Log in to your PayPal account at https://www.paypal.com. The My Account Overview page appears.

Click the Profile subtab.
The Profile Summary page appears.

Under the Selling Preferences column, click the Website Payment Preferences link. The Website Payment Preferences page appears

Under Auto Return for Website Payments, click the On radio button to enable Auto Return.

In the Return URL field, enter the URL to which you want your payers redirected after they complete their payments.

NOTE: PayPal checks the Return URL that you enter. If the URL is not properly formatted or cannot be validated, PayPal will not activate Auto Return.

Scroll to the bottom of the page, and click the Save button.

Raj

Anonymous said...

Thank You Man It Is Grate...

KRISHNA YADAV said...

Really, it's amazing tutorial for us...
Thank You....very much G...

Anonymous said...

Awesome bro.. helped me like HELL!!

Shyam Salim Kumar said...

Great tutorial.. Thanks a bunch!! Didn't know Paypal transactions were so easy. :D

But it seems that the transaction ID and all are now being sent via email to the registered email address of the Paypal user. So we won't be needing the `sales` table part :D

krishna said...

Someone please help me i am new in php and wnt to play this paypa script but when i go to import the downloaded file paypal.sql it gives error like this:

CREATE TABLE IF NOT EXISTS `sales` (
`sid` int( 11 ) NOT NULL AUTO_INCREMENT ,
`pid` int( 11 ) DEFAULT NULL ,
`uid` int( 11 ) DEFAULT NULL ,
`saledate` date DEFAULT NULL ,
'transactionid'varchar( 125 ) ,
PRIMARY KEY ( `sid` ) ,
KEY `pid` ( `pid` ) ,
KEY `uid` ( `uid` )
) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =12;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''transactionid' varchar(125),
PRIMARY KEY (`sid`),
KEY `pid` (`pid`),
K' at line 12

please help me
i will be very thankful to all of you...

krishna said...

Sir i have one more problem please help me i want to create pdf filefrom the "registered.php" using FPDF CLASS LIBRARY but when click on "create pdf" button it only convert the index to pdf but not values of their indexes is displaying.....please help me...this is my conversion code..

AddPage();
$pdf->SetFont('Arial','B',10);

$pdf->Ln();
$pdf->Ln();

$pdf->SetFont('Arial','B',10);
$pdf->Cell(20,15,"No");
$pdf->Cell(20,15,"name");
$pdf->Cell(20,15,"dob");
$pdf->Cell(20,15,"email");
$pdf->Cell(20,15,"address");
$pdf->Cell(20,15,"mobile");
$pdf->Cell(15,15,"gender");
$pdf->Cell(20,15,"country");
$pdf->Cell(20,15,"city");
//$pdf->Cell(20,15,"remarks");
$pdf->Cell(20,15,"image");
$pdf->Ln();
$pdf->Cell(1050,3,"--------------------------------------------------------------------------------------------------------------------------------------------------------");

$query = "SELECT * FROM register_user";
$result = mysql_query($query, $db) or die(mysql_error());
//$row = mysql_fetch_assoc($result);
//$totalRows_rsReportData = mysql_num_rows($result);
$No = 0;

while($row=mysql_fetch_assoc($result))
{
$No = $No + 1;
$name = $row['name'];
$dob = $row['dob'];
$email = $row['email'];
$address= $row['address'];
//$mobile = $row['mobile'];
//$gender = $row['gender'];
//$country= $row['country'];
//$city = $row['city'];
//$remarks= $row['remarks'];
//$image = $row['image'];
$pdf->Cell(5,15,"{$No}");
$pdf->Cell(20,15,"{$name}");
$pdf->Cell(20,15,"{$dob}");
$pdf->Cell(20,15,"{$email}");
$pdf->Cell(20,15,"{$address}");
//$pdf->Cell(20,15,"{$mobile}");
//$pdf->Cell(15,15,"{$gender}");
//$pdf->Cell(20,15,"{$country}");
//$pdf->Cell(20,15,"{$city}");
//$pdf->Cell(20,15,"{$remarks}");
//$pdf->Cell(20,15,"{$image}");
foreach($row as $value)
{
//echo $value;
}

}

$pdf->Output();
?>

Xavi said...


How to fix this error

Undefined index: item_number in C:\wamp\www\mvc\view\success.php on line 13

Undefined index: tx in C:\wamp\www\mvc\view\success.php on line 14

Undefined index: amt in C:\wamp\www\mvc\view\success.php on line 15

Notice: Undefined index: cc in C:\wamp\www\mvc\view\success.php on line 16

Suresh Amrani said...

any Help is apperciatable
Why this one

Notice: Undefined index: item_number \success.php on line 17

Notice: Undefined index: tx in

Notice: Undefined index: amt in C:\xampp\htdocs
Notice: Undefined index: cc in C:\xampp\htdocs\cubexsweatherly\paypal_lesson\success.php on line 20

Anonymous said...

please tell me how to turn on Auto Return for testing account?i have created 2 account as business and personal as preconfigured accounts.

Anonymous said...

another error on success php

if($item_price==$price && item_currency==$currency)

item_currency is missing a $

Anonymous said...

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\paypal(2.0)\products.php on line 40

getting this error pls help

Anonymous said...

All went perfectly..just one error while returning from paypal page.Got following error:
The requested URL /paypal/success.php was not found on this server.

Thanx for d tutorial

gopi said...

Hi

When i tried live demo from my browser its showing https://www.sandbox.paypal.com/cgi-bin/webscr page only reset of the things not coming , could you please advise any thing i missed out.

Anonymous said...

This code can't user for production site.Use Paypal IPN to receive payment notification.

http://code.google.com/p/paypal-ipn-class-php/

jessie jay Rubi said...

Man you saved my life many times already! :D

prabhupada swain said...

i am using the same code as mentioned but i my success url transactiion id is not coming .. what to do ?
please help

prabhupada swain said...

I am not getting the transction id after successful payment..
what to do ?

please help

Anonymous said...

Hi shirni..
I am using same code as you write in above post. But I am not receiving any parameters in my url. So can you please help me in this problem?

Anonymous said...

not working for me. redirect url not passing data.. Please help me

Kevin Teal said...

i had the same issue with paypal not auto returning or getting data about transaction.

if you log into your sandbox Seller account. click on profile and go to 'selling preferences' then in the list click on 'Website Payment Preferences' in here you have a few options, you need to set Auto Return to ON also make sure Payment Data Transfer is set to ON - this will give you the transaction id, the amount etc.

Kevin Teal said...

forgot to say thanks @Srinivas Tamada :D

Anonymous said...

can't get the transaction number..when back to sucess.php please help...

Anonymous said...

How to pass other custom values to paypal... because i want to save more than 5 values in success.php from client

Davis Mugira said...

thanks for the tutorial, i have a problem on success.php i get Payment Failed. and am using sandbox accounts where i can't selling preferences to configure auto-return urls.

if any would help me i would be greatful

Rashed said...

hi !

I am already used your paypal payment system.used send box system.payment successfully transfer one paypal to another paypal account.but database dont updated the payment transaction. please help me how to solve the problem.I am already follow your direction. But I cant solve.please help me.

amaz said...

i found this very informative thanks for sharing..

Suraj H.S said...

hi i liked ur post a lot and was helpful too.can u provide same example in jsp?

Suraj H.S said...

this was very helpful thanks but can u give same example in jsp?

Anonymous said...

hi and one more thin i tried ur code myself in jsp the prob with it lik u shown in live demo wen one clicks buy button it takes them to login for sandbox and shows order summary,but in mine its not showing tat.its just showing login to continue.and don display order summary.

My most precious Love said...

Awesome tutorial - ! good joob

jaskaran singh said...

Hi thank to share this video but i need paypal recurring payment method and get response with profile id. After that i want run cron on profile id to know this paypal is done or not every month..

VIKAS CHOUDHARY said...

we are going to use it in our classified sites...
A great way for transaction

Laura said...

Hi this is a great tutorial, quick thing i've got my sandbox set up and all working but when someone makes a payment it is going through ok on paypal but when you are directed back to the website its says payment failed. the information from paypal is not coming back to the website. Any ideas?

Anonymous said...

how to get responce automaticly from paypal ? plese explain

vishu love said...

can you please expalin how to get responce automaticly on sucess.php or how to show all payment detail on own website page after payment ?

Anonymous said...

I get this error:


Parse error: syntax error, unexpected '?' in C:\Program Files\EasyPHP-12.1\www\my portable files\GotMerch\New Folder\products.php on line 21


Whats going on there like?

Jim Ord said...

I'm impressed with the way you have condensed pages and pages of PayPal bumff into this concise and easily understood article! Well done!
P.S. Could you possibly explain how we can integrate a site to include credit card payment via PayPal? Not all our visitors have PayPal Accounts, but they do have credit cards...

Anonymous said...

nice code, this really help me

yasir said...

need help
its work fine with your $paypal_id ='sriniv_1293527277_biz@inbox.com' but when i use my email It not work properly what is the issue.
in previous reply
Srinivas Tamada said...
Paypal sandbox updated new sample biz id not redirecting properly.

now my question is have any other alternative method it must work with my Id its my university project help me please

yasir said...

neeeeeeeeeeed help

i tried this code every thing is ok but not get return value on success.php file.
i make new account on developer.paypal.com i must need retune value its my university project tell me alternative solution please i am waiting.

Anonymous said...

Can we refund any transaction by using same kind of form or is that compulsory to use API for refund. Please suggest.

yasir said...

sriniv_1293527277_biz@inbox.com id not working

paypal page give this error
This recipient does not accept payments denominated in USA. Please contact the seller and ask him to update his payment receiving preferences to accept this currency


Anonymous said...

I make buyer and seller account on sandbox if m trying u r demo then its working but its not working if i m trying it on my domian or local
giving this error

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/cyberdev/appoint.cybertronindia.com/testingpaypal/success.php on line 15
Payment Failed

Anonymous said...

hello sir ,

as i am using paypal , i already implied it , but after return paypal retusn a URL like this ---


"http://localhost:8082/btmcode/membership/payment_success?tx=6A569037D29032236&st=Completed&amt=30%2e00&cc=USD&cm=&item_number=&sig=AZMo27QReSlttWDtIVlmbpHDn33QCGaMTXuWNKp12dLpoJDrm%252bENyNnNJxv2H%252bYWdl%252bnp85BIwiTJK1Cl0H0Oq9fY0%252fSEwJCXz6FuBL12zZVatKj5%252bK%252bT2KjKHgbmJfklOh29q7nGxHYsRMoDiDyiam8rWbbthnE8dmawJxbHTM%253d"

this i am using for subscribing , i need your help to get the response code.

so i can make a condition after return its succeded or fail.

Aditi Champaneria said...

Hi Sri

I am Aditi Champaneria
So many follower and now one more !!!

ishak ali said...

hi for redirection problem every one follow
sakkona comments...

I followed his steps thank you so much sakkona

1. log in with Business mail account in https://www.sandbox.paypal.com/
2. click on profile link
3. under hosted payment settings > click Website payment preferences
in that, configure some points:
set Auto Return to On and type return URL address (e.g. http://localhost/paypal/success.php)
set Payment Data Transfer to On

thats all once again thanks u so much sakkona..

dinu37 said...

http://localhost/mywork/paypal/paypal/success.php..This is my successful page but after payment am getting transaction id ..but in url no arguments is passing

dinu37 said...

Anonymous said... please tell me me too getting same error no arguments passing through url showing payment error. what should i do for this

Anonymous said...

Thanks Srinivas

This is really helpful

Chaminda

Anonymous said...

nice tutorial

Rio Eduardo said...

Is it true that the redirection can only work if you use business-pro account(paypal payments pro)? Because I already tried it, and it really works. Thanks.

Prachi Rakesh said...

Very Nice tutorial, bt i can't able to mak payment, the following error is showing....pls help............the error is:-
"We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.
Return to merchant"

Prachi Rakesh said...

Hi Srini.....am new vth paypal,n doing this first time, eventhough im feeling itz very simple bcz of ur tutorial, bt i cn't abl to make payment, the following error is showing....
"We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com."
PLZZZZZZZZZZZZZ Help

Anonymous said...

i got errors in success.php page.

there have no argument passed to the return url in payapal after click to return.....

Brij Kishor Rajput said...

Hello Friends,

I am using live environment and I am not getting return parameter on success.php file.

any can help me.

Thanks
Brij Kishor

navin tanwar said...

Hi Srini... This is nice one tuttorial but i am facing a problem after payment its not redirect back to my PHP success page,even i have set return radio box on and specify the sucess path there

Noman Ahmed said...

Boss how can i send multiple items through your code ?

Anonymous said...

i got errors in success.php page.

there have no argument passed to the return url in payapal after click to return.....plz help

vipin kumar said...

i want the current transaction date and time in return

Anil said...

This script working perfect but how can i made split payment to two or more accounts

Anonymous said...

Please run below URL and you will get success page.

http://demos.9lessons.info/paypal/success.php?tx=9T051072DR109605J&st=Completed&amt=30%2e00&cc=USD&cm=&item_number=2

Sankar ssn said...

Payment is getting success, after payment it is not returning. am seeking for a solution nearly 3 days, some one help me soon.......

Anonymous said...

Hii,
Return url, after cancel the recurring paypal payment through manually...

Anonymous said...

i am not getting the txt and amt while returning from paypal please help me to get transaction, id order no and amt

Snapsti said...

HI
Plz provide Multiple item paypal payment gateway in php

Snapsti said...

hi
Srinivas Sir
how can i send multiple items through your code ?

Anonymous said...

hey, after downloading this tuts, i have redirection array empty, and paypal is now using REST API, can you please make this tutorial update on this REST API?

Rathish V said...

Last 3 days i am trying to integrated paypal integration in my project. Lot of confusion. Today(23-11-2013) only i see your page. Its very simple and very very useful to me. Thanks thalaiva.

Anonymous said...

when returning url after successful payment the payment status displays as pending in paypal sandbox.How to solve it?

Anonymous said...

hi,

can u explain about how to implement refund in paypal sandbox.

Sahil Fz said...

Hi Tamada,
How To Verify PayPal Account with VCC

mangesh deshpande said...

Hi my payment part is working fine but not able to direct to the success page and the sales table is also not updating. Plz help.

Jack said...

i not able to direct to the success page and the sales table is also not updating. Plz help.

Anonymous said...

you are not redirecting because paypal has changed the way id can be fetched in new accounts so enter your return url in your account settings.

Yugal Sutariya said...

Nice Post paypal payment system...
but i can recived payment in my paypal account....how can i create...plz reply...

Jack said...

then, this need a server online?

kamlesh verma said...

I haven't get this value from server
please help me..

$item_no = $_POST['item_number'];
$item_transaction = $_GET['tx'];
$item_price = $_GET['amt'];
$item_currency = $_GET['cc'];

kamlesh verma said...

Trascation id is not get from redirect time from paypal ......
please help ...

Lavanya said...

I have one problem.. I have two websites and one business account.. I saw some solution like creating each mail to each websites. But i don't know how to execute it in rea. Please help me anyone.....
Thanks in advance.

sunil Singh said...

Url not return on success.php please help me.....

Anonymous said...

my problem is the same:
Url not return on success.php.....Yeah pls help!

nandu said...

hi, thanks for providing this tutorial. I completed almost. i was able to retrieve transaction id and amount. but i need some more info regarding transaction like first name, last name,email etc.. could u plz help me out to solve this problem...

Thanks in advance..

Anonymous said...

Hello!
Thanks for your tutorial !
Unfortunately I don't know a lot about php .Have someone has this code , or just the paypal buying operation in JSP ? thanks in advance :)

Anonymous said...

nice tutorial...helpful

Anonymous said...

I haven't get this value

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

My transaction is done. but i got empty Array. please help

Anonymous said...

I haven't get this value
$item_no = $_GET['item_number'];
$item_transaction = $_GET['tx']; // Paypal transaction ID
$item_price = $_GET['amt']; // Paypal received amount
$item_currency = $_GET['cc']; // Paypal received currency type

SK said...

Hi All,

Please let me know the fix for this issue.

Issue : Paypal is not returning tx,st,amt,cc,item_number,

In other words it route correctly to success.php without returning above mentioned parameters

Anonymous said...

thankyou

Jyoti Sharma said...

Thanks ....

Anonymous said...

i am having the same problem as SK, when returning back to my success.php it wont pass the get variables from your script so it failes everytime

Vinothkumar Rajendren said...

how to change indian currency code value

Anonymous said...

Have you ever heard the term "Transaction"??? It's funny that you have put a "select" near an "insert into" assuming that nothing can change between both execution

Post a Comment