i'm trying to integrate paypal ipn in my site
Here's the situation :
All prices will saved in the database
when user select to pay the user will be transfered to paypal (with price given by db) ,after payment i want verify payment if its accurate and then want it to add certain rows in db !
i checked http://cms.paypal.com
but i couldn't get it work .
can anybody explain me ?
For Paypal ipn you need to setup a script which will keep handling requests from paypal server. Based on these requests you need to further process you order. Sometimes a order is accepted initially but later declined. You can handle these cases only if you have ipn in place.
For frontend basic payment processing use a simple form or paypal express checkout.
Related
On my website, I want to set up a "pay to remove ads" feature, and I want to collect payments for it through PayPal. The setup that I want for this is quite simple:
User pays
Payment is verified
The entry in the MySQL database containing the user's information is updated to disable ads on the site for that user
To do this, I want to use PayPal's IPN service. I understand the basics of it, but I am not quite sure how to implement it, nor do I understand how I can trigger the script to update the database for the correct user. I would imagine that to do this, I need to include some means of user identification whenever they begin the payment process, but I am not sure how to do that either. I am trying to implement this in PHP.
The process would be:
The user has an ID
When he pays, you attach this ID as the custom parameter in the PayPal request
You also define what url you want to call for the IPN
Once the payment is complete, PayPal sends the IPN
You verify that the actual status of the payment is "Completed"
You retrieve the user'ID from the custom parameter
You update your table
I hope it's clear :)
Im haing a problem iv been researching for weeks now on the paypal API but i just can't figer how to do this.
I need there to be a button on my website which then it goes to paypal.
Once you have paid the chosen amount it goes to a php page which updates the database though php.
You have to turn on paypal ipn in your paypal preferences. Once paypal has the money it sends you a transaction back to your server. In the script that accepts the transaction you can have it update your tables.
Documentation : https://www.x.com/sites/default/files/ipnguide.pdf
generally you pass a notify_url parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.
i found a tutorial here: http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/
I found more suitable the PayPal NVP API instead of tradional IPN (Instant Payment Method)
You can find several code examples for PHP (including very similar to your problem and more advanced) in the library code for NVP samples
I am new to sandbox and paypal payment gateway. I am using paypal adaptive payment to pay amount to two people at a time. My current code works perfectly. I am using the paypal generated code. I just want to know that is it possible that when the payment is made successfully can I make that entry to my database. I have my php code, but where do I need to write this?
Thanks in advance(plzz no down votes)
You should wait for the IPN message that contain details about the payment status
https://www.paypal.com/ipn
You need to define the url of the php script that listen for those messages in your paypal account. There are some php examples on how to implement it.
I'm doing a project involving Paypal, more specifically with the NVP API in PHP. But I just can't seem to figure what to use the IPN feature for.
I mean, when the user has been redirected to Paypal to confirm the purchase, he is redirected back to my website's "Paypal-succes-page", when the transaction is complete. And just to be sure that he actually payed i could use the "PaymentDetails" operation.
Now where does IPN fit in this process? and what is the benefit of it?
Thanks
The integrate with PayPal's services you will notice there are three main channels (and IMO it's important to know this so you can decide the benefits for your application):
IPN: Instant Payment Notification
PDT: Payment Data Transfer
PayPal's API
To use PayPal's IPN you need to add a 'listener' script (example) and add the address to your PayPal account. Whenever an event occurs PayPal will send a message directly to your server via your listener and you then update your accounts appropriately. This is especially useful for running subscription services as events will occur in the background without user intervention and you can capture successful/failed recurring payments etc.
PayPal's PDT is a system for accepting data when a user is redirected back to your site from PayPal. For example, a user clicks 'Buy', they are directed to PayPal, enter information etc. Then, once the payment has been taken, they are redirected back to your site. PayPal can pass details about the transaction including whether it was successful or not so you can display the appropriate success/failed page from your site.
PayPal's API allows you to integrate more deeply with PayPal's services, and you would use this if you were managing payments directly from your site.
These services aren't mutually exclusive, so you can use any combination with your application.
I hope this helps
The IPN feature is a very useful feature which you should use to update your database in my opinion. Sure the user is redirected to your success-page after the purchase where you can validate the payment details.
But what if he closes (by accident or not) the browser before reaching your success page? You will never know the result of the transaction and you will never update your database or process his order accordingly.
When using the IPN you can be sure that the transaction result will always reach you because PayPal will keep on making an offline request to your IPN page until it has reached your servers.
Instant Payment Notification
The typical usage of the IPN is to validate the purchase and to let your script or management system know that the transaction is complete so your system can update any records you may have for your service.
But the most important part is that the transaction is validated.
IPN send all data about transaction to your server - price, items, contacts ... so you can check, if someone don't pay you only 1$ instead of 100$ and confirm your order. It prevets thiefs, cheaters, ... USE IT! ;)
Am trying to create a way to setup the following:
User sends donation to paypal with info from donation site (name, email)
Paypal receives the donation and using the 2 variables it received (name, email) it sends them back to the donation site
Donation site receives variables and donation amount and changes some variables in the website to show that the user has donated some amount.
The site shows a list of users that have donated and how much they have donated which shows as points. How can I do this with paypal and php and mysql.
I'd suggest looking into using PayPal Instant Payment Notifications (IPN).
PayPal IPN allows you to (asynchronously) process order information while not having to depend on the buyer to return to your website to complete the order (which would be the case with PDT).
You can use IPN by setting up a script which receives this (POST) data from PayPal. In addition, you must include the following code in your button and/or API call(s):
For Website Payments Standard (where "xxxxxxxx" is the full URL to your IPN script):
<input type="hidden" name="notify_url" value="xxxxxxxx">
For Express Checkout:
Include NOTIFYURL=xxxxxxxx in your SetExpressCheckout and DoExpressCheckoutPayment API call
For Website Payments Pro
Include NOTIFYURL=xxxxxxxx in your DoDirectPayment API call
Once set up, you will receive POST data from PayPal with every transaction.
Take this data, and send it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate (Live) or https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate (Sandbox) to validate the data. If PayPal responds with VERIFIED (in the body of the page), you're sure the data is genuine IPN data coming from PayPal.
You can find sample code, documentation and further information on PayPal IPN at https://www.paypal.com/ipn
See also some IPN security best practices at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script
I found this tutorial, looks like what you're after.
http://tutorialzine.com/2010/05/donation-center-php-mysql-paypal-api/
Your first step is to use a paypal payments pro account. If memory serves correctly, you can only callback on pro accounts. Otherwise your paypal donation is pretty much a one way trip.
Please understand your question is very involved and is not likely going to result in a full blown example.
The best suggestion I can give is to read up on the paypal API documentation and see if the PHP API fits your needs...
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_overview
The PHP / MySQL end of things is on you at this point. You must store user information that you would use to send and validate the successful transactions based on the paypal API results.
While this answer may not serve your situation exactly, it is at least a small point in the right direction. I would suggest taking care to consider refunds and cancelled payments. If there is anything at all to gain by accumulating these "points" you mention then you need to cover security well. Otherwise you will be gamed and could stand to lose something if this is not done correctly.
If you have anything specific to add to this question to narrow down the possible answers, let me know and I will try to update this answer with a better, more specific response.
Set up Payment Data Transfer with PayPal,
PayPal PDT How To
Then on the page that receives the payment details from PayPal, calculate the number of points the person gets based off of how much money they donated (using whatever multiplier or point scheme you decide on), then log the data in a points field in the user's row of your user table in mysql.