PayPal data delivery problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
waqas_punjabian
Forum Commoner
Posts: 67
Joined: Wed Aug 10, 2005 9:53 am

PayPal data delivery problem

Post by waqas_punjabian »

Hi all,

i have products on a web page that is static , there is a buy button along with product . i m sending item no, and item name in following code to paypal.


Code: Select all

<form name="frm_prod1" action="https://www.paypal.com/cgi-bin/webscr" method="post">

   <input type="hidden" name="cmd" value="_xclick">
   <input type="hidden" name="business" value="waqasnisar@gmail.com">
   <input type="hidden" name="item_name" value="Bio Neo FS (First Stage)">
   <input type="hidden" name="item_number" value="1">
   <input type="hidden" name="amount" value="40">
   <input type="hidden" name="return" value="http://www.bioneo.com/quote_thanks.htm">
   <input type="hidden" name="cancel_return" value="http://www.bioneo.com/quote_cancel.htm">
   <input type="hidden" name="no_note" value="1">
   <input type="hidden" name="currency_code" value="USD">
									
   <input name="Submit" type="submit" class="blue11" value="  Buy Now  ">
                                    	
</form>


when user will click it he will be redirected to paypal account.

up to this level its going perfect.

Now the
Problem:

how can i recieve this item name or item number from paypal after completion of transaction.

because i want to email the sold product name to admin . how can i do that , kindly give me the code or help me.
i don't have any database involved in this project
take care of that

Thanks in Advance,
regards

Waqas
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post by phpdevuk »

paypal should pass back item_number as a $_POST varaible I believe
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

paypal allows you input a redirect url in a hidden field, which i see you have in the form :) .

Code: Select all

<input type="hidden" name="return" value="http://mysite.com/thanks.php?item_number=bla&other_var=bla">
above is just a sample, you need to adjust it your own needs, after payment, paypal will redirect the user to this page and then you can do whatever you like with the info in _GET.

you will need this hidden field with all the products, make it so when a product is added to the basket, the id gets added to the return url, i.e. "itemn=1&itemn2=2" etc, might wanna use a php page for that.
waqas_punjabian
Forum Commoner
Posts: 67
Joined: Wed Aug 10, 2005 9:53 am

Plz tell me one more thing,

Post by waqas_punjabian »

Thanks,

Plz tell me one more thing,


how can i test my transaction , i 've made a sand box account. But its the account of seller.

is there any test account for buyer or is there any test credit card number to check the transaction.

or i 'll have to pay for testing ?


waiting 4 ur reply,

Waqas
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

you have to make an account for buyer in the sandbox too, login your sandbox and have a look, there is a button.link for making accounts i think, when you have both accounts:

1. on your payment page it self, use:

Code: Select all

<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
2. login into the sandbox in IE, it doest really work in FF atm

3. while you are logged in SB, you can test your own site, if you dont login to sandbox first, you will get an error.

4. after payment testing etc, check the emails in sandbox to make sure its working.

5. when you are sure everythig is ok. change your form to:

Code: Select all

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">

------------------
testing is free with paypal, use this credit card (its not reall =P but it works)

Type: Visa
number: 4111 1111 1111 1111

and any valid from and expiry date.

good luck.
Post Reply