I am trying to get the transaction info of paypal transaction that is passed to our website when customer is redirected to our website.
I turned auto-return and pdt in my sandbox paypal account setting. I posted a sample transaction to paypal and it replied to my return url with tx appended.
As found in some docs I did a curl req to https://www.paypal.com/cgi-bin/webscr and tried to get information by passing the req values as follows:
a.) tx = same one received from paypal
b.) at = pdt code given by paypal while turning pdt on
c.) cmd= "_notify-synch"
but in result i get String(0) "".
What I am missing?
I'd highly 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.
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
You can find sample code, documentation and further information on PayPal IPN at https://www.paypal.com/ipn
Additionally, here's an article with additional steps on verifying the authenticity of IPN messages at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script
Related
Do anyone have similar experience?
I would like to know the difference between the notify_url and return in Paypal integration. As my understanding, Paypal will pass the transaction detail to notify_url for further action, but what if I set both notify_url and return in the form, how do I completing the notify_url and the call the return from php script?
Best regards,
Kelvin.
The Return URL is where PayPal sends the buyer after they've completed everything on the PayPal pages.
In the case of Payments Standard that would typically happen after the payment is completed, and then the return URL may be used in conjunction with PDT (Payment Data Transfer) to pass data to the return URL so that you may display it for the buyer as a thank you / receipt page. With API calls the ReturnURL redirection from PayPal generally happens prior to the payment being completed.
Notify URL is used with IPN (Instant Payment Notification) which is very similar to PDT except that IPN notifications are sent as a "silent POST" to your listener script on your server. These notifications will be sent in real-time with all transactions on your PayPal account so you can automate procedures for things like payments, refunds, disputes, cleared e-checks, etc.
I have set up a PayPal Sandbox account and have created a script to take payments using PHP/cURL which basically follows this tutorial. We have already purchased a PayPal Payments Pro account to use it with. Now I need to set up Instant Payment Notification (IPN) In order to show payment details on our confirmation page and keep track of transactions in our own database.
Questions:
How do I set up IPN in the PayPal Sandbox?
How does IPN tie into the NVP API I Used? I've seen several PHP Tutorials with code samples but none of them explain how to set it up with the API.
References:
Here is the NVP API Manual.
Here is the Order Management Integration Manual.
Here's an FAQ type post on PayPal.
Many Thanks.
IPNs should be enabled for you be default. If not, you can enable them from your PayPal account -> Profile -> My Selling Tools -> Instant payment notifications.
IPNs are triggered by API calls such as DoExpressCheckoutPayment, DoDirectPayment, RefundTransaction etc. In general, PayPal generates an IPN message when external events arise that might affect a transaction, such as disputes, chargebacks, eCheck clearing, and various recurring payment and subscription events.
When you setup your IPN listener,
Ensure it is reachable from the internet. You can use the IPN simulator to verify reachability.
Register a global IPN listener URL in the IPN settings page above OR provide a IPN notification URL with every API call. See the API reference to understand how this can be done.
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.
My need: I want users to click on button and goes to paypal, where they can login or add the credit card details and payment should be get done. In short, I don't want to store credit card info on my website.
I found 'Express Checkout' is a suitable paypal method for the same. Am I right?
Does this method requires return urls on https only or can work with simple urls?
Can anyone help me with tutorial or something for the same?
Thanks for all of your support.
Here is an excellent PHP Class for PayPal IPN I've used countless times, which doesn't require user registration: http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
Incidentally, IPN lets you set a return URL via PayPal, though with that class you can send a return URL to IPN before the user pays.
If you want a tutorial or more help though you'll need to tell us which language you're using.
The easiest and most flexible solution that comes without a monthly fee, and is available globally, is PayPal Express Checkout. Express Checkout does not require a https return/cancel URL.
Here is how it works:
Express Checkout is based on three API calls; SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment.
SetExpressCheckout sets up the payment and returns a token.
You redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=TOKEN-HERE, where TOKEN-HERE is the token you received earlier
After the buyer has agreed to the payment, he is returned back to your site.
You can call GetExpressCheckoutDetails and supply the token as a parameter to get the PAYERID of the buyer.
Call DoExpressCheckoutPayment with the token and PAYERID supplied to finalize the payment
Note: If you want to force the 'card details' screen to be displayed initially, and allow buyers to pay without having a PayPal account, ensure you're setting SOLUTIONTYPE to 'Sole' and LANDINGPAGE to 'Billing' in your SetExpressCheckout API request.
In addition, the 'PayPal Account Optional' setting must be switched to 'On' inside the Payment Receiving Preferences of your PayPal Profile.
You can find additional documentation for Express Checkout at https://www.x.com/community/ppx/documentation#ec as well as the SDK's and sample code at https://www.x.com/community/ppx/sdks#NVP