views:

880

answers:

1

Hi Does anyone know how to integrate a one time fee into paypal? The user clicks SignUp then is taken to a page to confirm t&c's and where they pay £50, they are then - if successful, taken to a page where they can enter details and create an account... but i only want this page to be visible to users coming from paypal...

I thought about using tokens, but i don't know how to use them ;)

+3  A: 

You can use the paypal IPN which they are plenty of code samples and the paypal sandbox has some great tools to get you started.

The flow would work like this.

  1. User selects that they want to sign up on your site and they fill out a form (contact info, accept terms and conditions, etc).
  2. They then click purchase registrations, etc.
  3. Your site posts all the details of the contact form along with the cost of registration to Paypal for the user to pay.
  4. The user completes payment on the paypal site and is taken to a success page which informs them they will shortly receive an email regarding their registration.

Your back end... 1. After the user pays, paypal will post the details of the transaction to a URL you provide. 2. Your system completes a handshake over a connection to paypal. 3. Paypal sends the details of the transaction back to your server and you validate the total and any other necessary validations. 4. After validation, you system generates an email to the new user with their account details.

Let me know if that does not make sense or what additional elaborations are needed. Also if you let me know what language your coding in, I can pull up some sample code for you.

[EDIT] Here is a URL to the paypal IPN --> https://www.paypal.com/ipn

--Dan

[edit]

Here is an example form. This form posts a single item for payment to paypal.

    <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr"&gt;
<input type="hidden" name="rm" value="2" id="PayPalRm" />
<input type="hidden" name="cmd" value="_xclick" id="PayPalCmd" />
<input type="hidden" name="business" value="[email protected]" id="PayPalBusiness" /> 
<input type="hidden" name="return" value="http://localhost/inventories/success" id="PayPalReturn" />
<input type="hidden" name="cancel_return" value="http://localhost/inventories/cancel" id="PayPalCancelReturn" />
<input type="hidden" name="notify_url" value="http://localhost/Paypal_orders/process" id="PayPalNotifyUrl" />
<input type="hidden" name="item_name" value="product name" id="PayPalItemName" />
<input type="hidden" name="quantity" value="1" id="PayPalQuantity" />
<input type="hidden" name="no_shipping" value="2" id="PayPalNoShipping" />
<input type="hidden" name="shipping" value="2.5" id="PayPalShipping" />
<input type="hidden" name="shipping2" value="2.5" id="PayPalShipping2" />
<input type="hidden" name="no_note" value="1" id="PayPalNoNote" />
<input type="hidden" name="lc" value="US" id="PayPalLc" />
<input type="hidden" name="country" value="US" id="PayPalCountry" />
<input type="hidden" name="bn" value="PP-BuyNowBF" id="PayPalBn" />
<input type="hidden" name="amount" value="12" id="PayPalAmount" />
<div class="submit"><input type="submit" value="Click Here" /></div></form>
Dan
Hi! :)Thanks for getting back to me,This does make sense but how would i stop the user from visiting the page that makes , in my case , some sql statements adding the user's information..?Would i move ALL the registration data (a good few fields) to paypal along with the price - then they pay and move it back to my server...?Have you got iChat? [email protected] :D
tarnfeld
Hi againJust looked at your link, i was hoping for a more Buy Now button - with the wizard at paypal.comThe only issue with this i have is stopping the user visiting the confirmation url after someone would pay...
tarnfeld
Also haha..I am coding in PHP, Javascript, HTML for this website.....Some sample code would be fantastic!
tarnfeld
You verify that the person visiting and passing parameters to the "process" page by completing a small handshake with Paypal. This verifies that it is indeed paypal who is contacting you. It's a very simple buy now button that you would be using. Since I'm not going to re-invent the wheel...here is a good code example of paypal IPN code. http://www.studiocanaria.com/articles/paypal_ipn_controller_for_cakephpThis uses the cakephp framework but it's easy to adapt for use outside the cake framework. There is also a paypal sandbox page that allows you to send an IPN result to your page manually
Dan
HiI have been experimenting with the IPN - I have got it working now - i used the sandbox IPN simulator to tweak my script, and finally worked out to use the <input type="hidden" name="notify_url" value="MY_IPN_SCRIPT.php"> Thanks for your help!! :)
tarnfeld
HiThanks :)Sorted
tarnfeld