Hi all,

After browsing some forums for a topic that could answer my question, i
decided to post a detailed post about my questions.

Here it is;

Goal: offer credit/points package to members. Various package various price.

Brief info : Credit/points package will allow members who have purchased
them to be used in restricted section or parts of the website. Once the
credit/points are at 0, give the member the opportunity to purchase more
points using PAYPAL® payment system.

Note: Before being able to purchase any points, the user would have to be a
fully registered member of the site first.

What i plan on using :

Mysql Database
PHP4
HTML
No SSL (for now)

The system i want to input :

Using Paypal "Buy now" button or a customized image to associates the
credit/points package to a member and add it to their account once payment
is fraud/check and approved.

Example:

1 - 100 credits 5.00$ ( associated to buy button 1)
2 - 150 credits 8.00$ ( associated to buy button 2 )
3 - 300 credits 10.00$ ( associated to buy button 3 )
4 - 400 credits 12.00$ ( associated to buy button 4 )

I would like to pass some variables related to the members while they
purchase credits for verifiactions purposes and of course to add the credits
to the appropriate member once the payment is approved. I need to keep track
of those var and be able to access them during the whole payment process.

Now as a graphic artist, programming is a new world for me, i have chosen
PHP/MYsql as my new ground to explore and i still got lot of exploring to do
, so bare with me :-)

From the html generated after creating a buy now button. I would like to add
hidden fields where i intend to store extra variables which like i
mentionned above , will be related to the member.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="seller@email.com">
<input type="hidden" name="item_name" value="myitemid">
<input type="hidden" name="item_number" value="myitem_number">
<input type="hidden" name="amount" value="10.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return"
value="http://www.mysite.com/memberdir/thankyou.php">
<input type="hidden" name="cancel_return"
value="http://www.mysite.com/memberdir/cancel.php">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="puid" value="<?php print '$puid'; ?>">
<input type="image" src="http://mysite.com/images/mybuybutton.gif"
border="0" name="submit" alt="Click here to buy 100 member points">
</form>

Now using my previous young experience with PHP4, i would like to add these
hidden fields using php to dynamically at the appropriate member email and
username:

<input type="hidden" name="member_mail" value="<?php echo '$member_mail';
?>">

<input type="hidden" name="member_username" value="<?php echo
'$member_username'; ?>">

Now are the question that raises in my brain:

Can i do this?
Is this the right way to do this?
Will Pay Pal get, process and keep those vars and return them in the return
URL?
If so, will PayPal keep the same var name?

can i even more extra variables using the same method?

Now the IPN, (correct me if im wrong) if i understood correctly from what i
read, it is basically the informations about the pruchase and the buyer
informations.

Im not familiar at all with this so let see if this makes sense. Can i use
that inforation and store it in a mysql database. Obviously i want to assign
the IPN info to the member who bought the credits and add those credits to
his/her account.

Now aside of the basic IPN infos, if i added the hidden fields , will the
IPN also include those extra var? so i can store them and from that info add
the credits to the member account.

Can anyone give me some advises on this post, or point me to an efficient
tutorial site about identical process using PHP?

    Write a Reply...