I'm building an application with Codeigniter where the users can access a form to create their profile, after they fill the form they have to pay through Paypal and if the payment was successful the profile is created on the database.
How do I store the data submitted on the form so I can use it after the Paypal payment?
Should I insert it in the database when the user submit the form in the first place?
Should I use sessions?
The form includes multiple file inputs
You need to use Instant Payment Notification(IPN)
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of events related to PayPal transactions. Merchants can use it to automate back-office and administrative functions, like fulfilling orders and providing customers with order status.
Sample Codes
Are you having SandBox account? Manage all you prior testing in Sandbox.
For receiving the data about the paypal payment you nees to install the library.
Here is the link -https://github.com/orderly/codeigniter-paypal-ipn
Set up the library files accordingly.
After this go to IPN simulator of your Sandbox Account on - https://developer.paypal.com/webapps/developer/applications/accounts
try sending IPN .
Note - For testing IPN stimulation you will need live site, you can't test on localhost.
Related
I am making a event hosting website using php as backend language.So in this site we are showing various kind of events. So when user comes to our site he/she can register on the site and after registering he/she can browse through the events of their choices. Now they can buy a ticket for any event in which they want to participate.
To make the payment process I have integrated paypal api. So when a user will click on Buy Ticket button on any event and he/she will be redirected to paypal portal to proceed for payment.
I also need to store the info in my database that whom has made successful payments for which event. But the problem I am facing is that when someone returns from paypal after making successful or may be unsuccessful payment then the session variable in which I have stored the userid, that variables becomes empty.
Now if I don't know the userid who have done the transaction, then how I can store the user with the transaction to the database.
I know that on various shopping sites same kind of functionality must be implemented but I want to know how people implement this with paypal.
You can integrate the IPN function(which is PayPal's service) to fix the issue.
IPN(Instant Payment Notification) is a PayPal feature that sends messages about payments
(and other transactional events) directly from PayPal to your website(s)' back-end systems.
Logic:
While a payment received on your PayPal account, PayPal will send IPN message to your IPN script almost at the same time.
After receiving the IPN , your system can refer the IPN message to do the subsequent processing- update payment status into your system or send email etc.
But the follow-up actions need to be integrated by your system(Including send email system).
This process is complex, but it is the only way to achieve your marketing goal.
Following and the IPN integration guide.
Please kindly refer them.
https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/
IPN code samples:
https://github.com/paypal/ipn-code-samples
IPN variables:
https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/
Thanks.
I am using parallel adaptive payment. i got the php coding from following link of paypal developer` website.
https://www.paypal-labs.com/integrationwizard/adaptive/main.php
Now the transaction of amount takes place successfully. But i want to store the transactions details such as
1.transaction id,2. Amount 3.Status etc. After the returns from paypal to my website
Presently i did this with paypal sand box account
You could use IPN to get information back to your website that pertains to the transaction. You can find more on IPN on PayPal Developer's Site.
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! ;)
i have a client that provide a service on his website.he wants to automate the service orders.
the service has these steps:
1- user submit a form with request.
2- my client review the request, validate it and use the info in this request to :
3- login to another website
4- buy a product from this website using his paypal account.
5- downlad and send the product in email to the user.
i was able to automate all of this using curl.the only problem i have is the purchase process using papal.i didn't deal with paypal before.so i want to know if i can just submit the papal form on the purchase website using curl.or this will not work?
while searching i found something about papal IPN.but i don't know if my client have this IPN in his papal account or not? also, he does not want to give me his papal info. is there is anyway i can do this with fake paypal account to try it?
thank you so much.
First of all, sign up for a PayPal sandbox account: https://developer.paypal.com/devscr?cmd=_signup-run
It's a really slick system PayPal put together for developers to test out stuff.
Secondly, review the PayPal API's at:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks
I believe all you need is the PHP Name-Value pair or Website Payments Standard interfaces.
IPN stands for Instant Payment Notification, it's a way for PayPal to tell you that a payment was made.
What you are looking for is either the PayPal NVP or SOAP interfaces.
Im planning to allow people to create premium accounts on a site. There is a simple registration form, at the end of which I want to direct people to paypal where they will make a payment, and then be sent back to my site with their newly created account now activated (if transaction went thru).
I dont want a fully hosted solution ("Website Payments Pro"), but something where you leave the site, and then come back to it after payment.
Everything you need to get started
View sample code
View all tech docs
Download SDKs
API Reference
Using the PayPal API, you'll be able to send users to PayPal to handle payments. Once the transaction has been completed it will then send a response to a script on your site, which you can then act on accordingly. For example, update a particular user's status as 'Paid' or 'Unpaid' in your members database table.
You want to look at PayPal IPN. With that, you can send these pages URLs as hidden fields and PayPal will then return the user to the page you submitted for success, failed, IPN handler etc.
Yes that's possible, look into the "Buy now"-method on PayPal, they have an off-site payment possibility and they have on-site payment. It's up to you how much you want to spend on both time and percentage on each sale.