Jump to content

PHP with Paypal


sh0wtym3

Recommended Posts

Hey all,

 

I'm using a paypal checkout button on my site. Once clicked the user is taken to paypal where they can pay for the item, and if the payment is successful they get redirected back to a confirmation page on my website

 

The button code they provided me lets me pass custom variables over to paypal, such as "item_number" which I fill by using the current item number stored in a variable called $itemID. See below:

 

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"[email protected]\">
<input type=\"hidden\" name=\"lc\" value=\"US\">
<input type=\"hidden\" name=\"item_name\" value=\"$title\">
<input type=\"hidden\" name=\"item_number\" value=\"$itemID\">

 

I need to be able to access this $itemID variable on the checkout page as well. This way I can query the database and update the sale count for that item.

 

Has anybody here used PHP with paypal buttons before? Do you know if the variables are passed back to the confirmation page via the URL?

 

Or is this any other way I can accomplish this that I'm not thinking of? Storing the $itemID in a cookie when the paypal button is clicked or something?

 

I tried calling paypal customer support but they barely even know what HTML is, let alone the dynamics of passing form variables and such.

Link to comment
https://forums.phpfreaks.com/topic/185143-php-with-paypal/
Share on other sites

so, you need to query the db upon a successful transaction?

 

variables are only passed back to your site through a postback option using an input field called "notify_url" where you called an IPN (Instant Payment Notification) script, which allows you to send POST_BACK data to the script within the <input> below (ipn.php).  within that file you can then do what you wish with that data (update database, set sessions/cookies, etc.).

 

there is a ton of developer documentation in the PayPal Developer section @ PayPal.

 

<input type="hidden" name="notify_url" value="https://www.your-ste.com/php_paypal/ipn/ipn.php" />

 

am i following?  if not, please be more specific.

Link to comment
https://forums.phpfreaks.com/topic/185143-php-with-paypal/#findComment-977318
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.