Reputation: 161
I am building a simple web app that will allow users to sign up and then use the web application. I want to add a payment mechanism after sign up but before the web app functionality can be used.
For example:
I would be OK if after step 3 a new page was loaded with the web app functionality, but the same page exposing the functionality (e.g. showing a div) would be a better UI in my opinion.
I have never integrated PayPal with a web app (PayPal buttons don't count!) and curious to know how to set this up given my web app is sporting a vanilla LAMP architecture.
Any help or pointers to guides or sample code would be greatly appreciated. Just as useful would be any pitfalls to watch out for as I go about this exercise.
Thanks.
Upvotes: 3
Views: 1566
Reputation: 28539
PayPal offers a notification mechanism just for the purpose such as yours. The asynchronous IPN mechanism and synchronous PDT mechanism. IPN is better suited for backend tasks (in your case DB update. However, since you need to offer additional features to your user after payment is done PDT is probably better as it is real time
You have easy snippets for all main programming languages on www.x.com,
If you are really going to implement this, read about differences between IPN and PDT, they pass around same messages but the risks associated are different. Which one you need always depends on the context.
Upvotes: 3
Reputation: 4287
Any simple ajax tutorial will help you with this. The only thing you need to do is something like this:
premium.php
<?php
$query="SELECT 'user' FROM table ETC ETC ETC"; //the query to test if paid
$RESULT = MYSQL_QUERY( bla bla bla, $query);
if $RESULT ... = true
{
echo "<div> THE PREMIUM CONTENT</div>";
else
echo "<div> please pay to see the content </div>";
}
?>
Just call premium.php in the ajax code. Hope it helps.
Upvotes: -2