• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paypal Registration Application

#1
[eluser]Jesse Schutt[/eluser]
Hello all!

Sorry to give a disclaimer right off the bat, but I am still working at getting my feet wet with this CI stuff. So please be patient with me!

I am building an application that will be used to register individuals for a particular event. So far I have the forms built, passing the data to my database, and emailing me the results. What I need to do now is implement a PayPal payment gateway. Ideally the payment would happen prior to sending me the email and posting to the database. I'm sure this will entail IPN...

Can someone please give me some general direction as to how to make this happen?

Thanks in advance.

Jesse

PS - I am fairly active in the ExpressionEngine forums, and hoping that the CI forums will be a positive experience :cheese:

#2
[eluser]CI Lee[/eluser]
Hey Jesse,

I am using http://codeigniter.com/wiki/PayPal_Lib/ on my job board site with great success. Its pretty simple to integrate and does a pretty swell job.

If you look at that and go that route I will be able to send you some examples of how we are using it.

-Lee

#3
[eluser]Jesse Schutt[/eluser]
Lee,

That is the direction I am currently heading. I would love to see some examples of it in action! Could you pm me with it?

Thanks so much!

Jesse

#4
[eluser]Jesse Schutt[/eluser]
OK, let's see if what I am thinking makes sense regarding this application.

I have written out the steps that I think need to take place in the logical flow.

1. Build the Main Form
2. Validate the Form Data upon Submission
3. Transfer the user to PayPal with the PayPal_lib
4. Client fills out payment details on PayPal's site
5. Client is transferred to a confirmation page
6. I receive the IPN confirmation from PayPal
7. Details [edit]from the original form[/edit] are posted to the DB and emailed to the Client and myself

Is there anything that I am missing for this?

Thanks in advance!

Jesse

#5
[eluser]Dave Rau[/eluser]
Could someone post some code here about this topic. I've been looking for some example code myself for this.

#6
[eluser]Jesse Schutt[/eluser]
OK, so as I have been processing this, I have run into some issues. Step number 7 above says that I want the details posted to the DB and emailed. However, the details I am referring to are the ones that the user had submitted into the original form. Is there any way to access those once the user has gone all the way through the payment process? Or, do I need to submit them to the DB prior to sending the user to PayPal?

What I am thinking now is that I need to post them to the DB right after the form validation with an indication that the payment is not complete. After I receive the IPN confirmation, I am trying to update the DB with a "Yes" in the payment_received field.

The problem I have with that is how can I connect a certain DB record with a particular IPN?

Help?!

Jesse

#7
[eluser]Dave Rau[/eluser]
Hey Jesse, I've done it both ways. You can pass an item number in paypal; this is my basic setup:

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

<input type="hidden" name="on0" value="Size" />
<p class="picksize">sizes in stock:<br />
<select name="os0" class="sizeoptions"><br />
<option value="s">small</option>
<option value="m">medium</option>
<option value="l">large</option>
<option value="xl">x-large</option>
<option value="xxl">xx-large</option>
</select>

<p>&lt;input type="image" src="/img/buy.gif" name="submit" alt="Buy via PayPal" id="addtocart" /&gt;&lt;/p>
&lt;input type="hidden" name="notify_url" value="/ipn_script.php" /&gt;
&lt;input type="hidden" name="cmd" value="_cart" /&gt;
&lt;input type="hidden" name="business" value="info@resisttoday.com" /&gt;
&lt;input type="hidden" name="item_name" value="Octo polo" /&gt;
&lt;input type="hidden" name="item_number" value="244" /&gt;
&lt;input type="hidden" name="amount" value="38" /&gt;
&lt;input type="hidden" name="currency_code" value="USD" /&gt;
&lt;input type="hidden" name="lc" value="US" /&gt;
&lt;input type="hidden" name="add" value="1" /&gt;
&lt;/form&gt;

#8
[eluser]Dave Rau[/eluser]
I should have also mentioned if you go the first route then you need to pass another hidden variable with an order ID, so your cart would send the data to another page that submits the order to the db, gets an id for the last insert and then passes that to paypal. You could use a javascript redirect for that, that's what I did for that scenario.

#9
[eluser]Jesse Schutt[/eluser]
I'm not quite following what you mean. My application is "selling" only one item, which happens to be a $50 registration fee. So, I wouldn't have different item numbers. In the original form, the user submits their contact information, as well as any guests that will be attending with them. I would like to be able to grab the post variables from the original form, not PayPal's. Is that possible?

Thanks for the feedback!

[edit] Cross-post! :-)

#10
[eluser]Dave Rau[/eluser]
I know there are some ways to pass custom variables but you'd have to look at the IPN notification docs. It's been a while since I've touched the paypal stuff. Sorry mate.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.