How to Get the transaction details once the payment via paypal completed - php

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.

Related

Paypal Rest Api - recurring payment issue

I'm trying to setup recurring payments in Paypal for my website using REST API, and I have 2 questions/problems:
Can't see transaction details in the paypal checkout page:
For one time payment, I know how to display transaction details by providing values for item_list (as in https://developer.paypal.com/docs/api/).
However I don't know what values we should provide so that recurring payment profile will be shown on checkout page as well.
In the below picture(left side) you can see that no information is presented to the client regarding the payment amount and setup fees.
If I switch to production environment when the user tries to make a recurring payment, the user is redirected to the paypal website and he sees this error:
Sorry, we weren’t able to set up preapproved payments at this time.
Please return to the merchant and choose another way to pay.
So what's the issue with the recurring payment:
Why the user does not see any information regarding the payment amount in checkout paypal checkout page.
Why in production env the user gets that error message?
I'm using this documentation:
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/CreatePlan.html
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/CreateBillingAgreementWithPayPal.html
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/ExecuteAgreement.html
How will I be notified when a paypal client cancel the recurring payment?
It is important for my web application to know when somebody cancel the recurring payment.
I read something about webhooks, is this the way?
Can you give me some documentation?
My location is Romania, if this matters.
Thanks,
Catalin

How to store successful transaction details in mysite's database after a user bought a ticket from my site by making payment through paypal?

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.

PayPal adaptive payment success function

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.

Paypal IPN needed?

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! ;)

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

Categories