I am using the Paypal Express Checkout and everything working good except the shipping carrier not being updated when the Callback is being called.
I can verify the callback is being called (call is logged).
When Paypal call the callback URL with the customer shipping country I return the following values.
METHOD=CallbackResponse&OFFERINSURANCEOPTION=false&CURRENCYCODE=USD&TOKEN=EC-5Fsdf5523823&LOCALECODE=en_US&L_SHIPPINGOPTIONNAME0=USPS&L_SHIPPINGOPTIONLABEL0=First+Class+%283-7+Days%29&L_SHIPPINGOPTIONAMOUNT0=0.00&L_SHIPPINGOPTIONISDEFAULT0=true&L_TAXAMT0=0.00&L_INSURANCEAMOUNT0=0.00&L_SHIPPINGOPTIONNAME1=USPS&L_SHIPPINGOPTIONLABEL1=Priority+%282-3+Days%29&L_SHIPPINGOPTIONAMOUNT1=7.95&L_SHIPPINGOPTIONISDEFAULT1=false&L_TAXAMT1=0.00&L_INSURANCEAMOUNT1=0.00&L_SHIPPINGOPTIONNAME2=UPS&L_SHIPPINGOPTIONLABEL2=Next+Day+Air&L_SHIPPINGOPTIONAMOUNT2=39.95&L_SHIPPINGOPTIONISDEFAULT2=false&L_TAXAMT2=0.00&L_INSURANCEAMOUNT2=0.00
The Callback message is being echo'd through PHP (I even tried save this as a txt file and point the callback URL to this file), even then Paypal doesn't update the Shipping Method.
I also changed CALLBACKTIMEOUT to 6 seconds but it doesn't matter. I am using HTTPS and also tried it with normal HTTP.
I am testing this in sandbox mode.
Anyone could help me out? I am really stuck here and I have been searching for similar problems but couldn't find any.
For your information I followed this Paypal guide : https://developer.paypal.com/docs/classic/paypal-payments-pro/integration-guide/WPInstantUpdateAPI/
I also checked if I am returning all the required fields as described here :
https://developer.paypal.com/docs/classic/api/merchant/Callback_API_Operation_NVP/
I hope someone can help me out, thanks in advance!
UPDATE
I try the NO SHIPPING OPTION
METHOD=CallbackResponse&NO_SHIPPING_OPTION_DETAILS=1&CALLBACKVERSION=95.0
Paypal responds with 'doesnot ship to this location. Please use a different address.'
So the response url is working, the problem is when responding with other shipping options.
Regards,
Kuroudu
I was having the same problems as you, but then I tried the example code from the PayPal Instant Update integration guide and added it as a text file on my server:
METHOD=CallbackResponse&OFFERINSURANCEOPTION=true&L_SHIPPINGOPTIONNAME0=UPS+Air&L_SHIPPINGOPTIONLABEL0=UPS+Next+Day+Air+Freight&L_SHIPPINGOPTIONAMOUNT0=20.00&L_TAXAMT0=2.20&L_INSURANCEAMOUNT0=1.51&L_SHIPPINGOPTIONISDEFAULT0=false&L_SHIPPINGOPTIONNAME1=UPS+Expedited&L_SHIPPINGOPTIONLABEL1=UPS+Express+2+Days&L_SHIPPINGOPTIONAMOUNT1=10.00&L_TAXAMT1=2.00&L_INSURANCEAMOUNT1=1.35&L_SHIPPINGOPTIONISDEFAULT1=true&L_SHIPPINGOPTIONNAME2=UPS+Ground&L_SHIPPINGOPTIONLABEL2=UPS+Ground+2+to+7+Days&L_SHIPPINGOPTIONAMOUNT2=5.99&L_TAXAMT2=1.99&L_INSURANCEAMOUNT2=1.28&L_SHIPPINGOPTIONISDEFAULT2=false
This at least gave me a CallbackResponse that finally worked which I then could update with programming to make it function the rest of the way. Spent many hours ripping my hair out. As PayPal doesn't really provide any means of debugging the CallbackResponses, I was happy to have a functioning starting point.
Hopefully this helps to point others in the right direction.
Related
I really need help because I don't know what to do at this point. I developed a website where the new user need to pay for sign up, I set the correct paypal form button and about the money everything works ok, the problem is that I can't update my database. I'm using these files (they are provided on gitHub and also in the official Paypal guide there's a link to them): "PaypalIPN.php" and "example_usage.php". I also added to my Ubuntu cloud server (where is my website) the cert/cacert.pem, I don't know if I had to do but in the first file seems to be required.
I tried to run a IPN simulator but it doesn't work, I looked for the same problem and I found that there may be a problem with the simulator, so I made some real transactions (I've read that live production test is run correctly with that code).
Therefore:
the transaction money is ok;
in the Instant payment notification history there are all test I made and in message ID I can read the correct data passed in the IPN message, the IPN type is "Transaction executed" and the response code is 200. I noticed that in "example_usage.php" the 200 response code was out of the if ($verified) so, just for my last test, I put that inside the if and yes, the response was again that;
I tried my code for update the mongodb database with fake data and obviously it works.
How is it possible? Please, help me and thank you.
Did you verify the correct URL is showing in the IPN History details? Sometimes people are using a button that uses notify_url to override the PayPal account setting, and then IPNs are working, but they're going to a different place than expected. So check that first.
If the IPN is indeed going to the URL you expect, and it's returning a 200 OK, that means it's receiving and completing the script successfully. If you aren't seeing the expected result in your database then you must have some sort of a logic problem with your code that needs to be addressed. You need to build in some trackers to log files or send yourself emails as it does each step of your script to see if that portion of code is actually getting hit like you think it is.
I put together this article for how to test PayPal IPN a while back that has proven helpful for many people. If you follow the steps there you should be able to track down the problem.
I am having getting PayPal to update shipping options based on country when a customer selects their shipping address.
I am attempting to use the Paypal Instant Update API and have followed the instructions but to no avail.
I am currently just using the Paypal Sandbox; but it doesn't seem to behave.
I am able to generate what I believe is the correct response and send it, however Paypal just uses the defaults set with the initial request. Logs show the response being sent, I've even put the response in to a database so I can see what it was (and it is as expected).
I've tried may things http, https, disable gzip, urlencode, file with static content, and nothing seems to be working. Here is what my response currently looks like:
METHOD=CallbackResponse&L_SHIPPINGOPTIONNAME0=2nd+Class&L_SHIPPINGOPTIONLABEL0=2nd+Class&L_SHIPPINGOPTIONAMOUNT0=1.50&L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONNAME1=1st+Class&L_SHIPPINGOPTIONLABEL1=1st+Class&L_SHIPPINGOPTIONAMOUNT1=2.00&L_SHIPPINGOPTIONISDEFAULT1=false&L_SHIPPINGOPTIONNAME2=Special+Delivery&L_SHIPPINGOPTIONLABEL2=Special+Delivery&L_SHIPPINGOPTIONAMOUNT2=6.00&L_SHIPPINGOPTIONISDEFAULT2=false
I really don't know what I'm doing wrong, and Paypal don't seem to offer any way to debug callbacks. Any help would be very much appreciated :)
Sorry for the very basic nature of the question, but I've been searching for two days and I'm still not sure how to do this.
I've got a paypal cart/store set up. How do I leverage either paypal IPN or a third party service to identify one specific item of the three items I have for sale, and send me a notification that a copy has been purchased, and then update a counter on my original website?
Again, just suggestions or a guideline would be greatly appreciated - even to point me in the right direction. Thank you.
A basic guideline for you:
have a sandbox account (I assume you already do)
create there a seller and buyer account
set IPN setting for seller account to your testing URL (where you will be checking for certain data returned)
for the URL mentioned above create a php file with IPN validator
and go here https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id08CTB0S055Z to check variables you will be searching for.
I assume you would need to pick num_cart_items and loop throug possible item_nameX variables returned.
You don't need to code anything to validate IPN, use some of these classes:
http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
http://www.phpclasses.org/package/2249-PHP-Process-Paypal-payment-interactions.html
I'm designing a database system, which sells courses to students. This is all done within PHP. I want to take Paypal payments on my website and having done some research I need IPN.
I've been reading docs/guides on how to achieve this from www.x.com but its quite confusing to find info I need as there seems to be more than one way of doing something. The IPN stuff looks pretty straight forward, paypal just needs the unique Invoice number, which the notify script uses to retrieve the record and post the appropriate response into a database and if all goes well, redirect page to a thank you.
The thing is which method do I initially send my values across to Paypal, I don't really want to pass on quantity and shipping data as all of these pieces of data are irrelevant I don't want my end user to see. Do I have to start looking at using the paypal api?
Thanks for the advice
Since your question seems to be "where should i start looking for a good paypal integration with php" i'll give you some general "advice". I had the same problem just a couple of months ago.
Yes you've to read paypal docs, and unfortunatly they don't have the gift of clarity.. very complete but i didn't find them very clear.
However this php class has been very helpful for my similar project: https://github.com/Quixotix/PHP-PayPal-IPN hope can help you too.
Also these articles/classes/docs has been helpful (but at the end i'm not using them) to clear my mind about PP integration:
http://drewjoh.com/wiki/code/classes/phppaypal
http://www.geekality.net/2011/05/28/php-tutorial-paypal-instant-payment-notification-ipn/
set up a sandbox account https://developer.paypal.com/
then go through some of the tutorials
you will also need to set up some test accounts, pay attention to the nav on the left (from the developers page). It has everything you need
I'm working on Paypal integration in my website, following Paypal's API specifications. I'm testing it in a sandbox, and after sending a SetExpressCheckout request like this:
CURRENCYCODE=EUR
&RETURNURL=http%3A%2F%2Fwww.xxxxxxxx
&CANCELURL=http%3A%2F%2Fwww.xxxxxxxx
&PAYMENTACTION=Sale
&L_PAYMENTREQUEST_0_NAME0=T-shirt+ring-spun+attillata%3B+taglia+L%3B+colore+Navy
&L_PAYMENTREQUEST_0_NUMBER0=0LLR7IQ-B0SIE+%28Product+%230LLR7IQ-B0SIE%29
&L_PAYMENTREQUEST_0_DESC0=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT0=1.90
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME1=T-shirt+ring-spun+attillata%3B+taglia+M%3B+colore+Dark+Heather
&L_PAYMENTREQUEST_0_NUMBER1=0LLR7IQ-2KEI1+%28Product+%230LLR7IQ-2KEI1%29
&L_PAYMENTREQUEST_0_DESC1=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT1=1.90
&L_PAYMENTREQUEST_0_QTY1=1
&L_PAYMENTREQUEST_0_NAME2=T-shirt+ring-spun+attillata%3B+taglia+S%3B+colore+White
&L_PAYMENTREQUEST_0_NUMBER2=0LLR7IQ-TFOHI+%28Product+%230LLR7IQ-TFOHI%29
&L_PAYMENTREQUEST_0_DESC2=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT2=1.59
&L_PAYMENTREQUEST_0_QTY2=1
&ITEMAMT=5.39
&TAXAMT=1.08
&SHIPPINGAMT=0.00
&AMT=6.47
&ALLOWNOTE=1
&USER=XXXXXXXX
&PWD=XXXXXXXX
&SIGNATURE=XXXXXXXX
&METHOD=SetExpressCheckout
&VERSION=53.0
I forward the user to here, which is the token Paypal gives me back in response to my first request.
The problem is that, despite the successful request with all prices set in, I have an empty Paypal review page, with absolutely no prices into.
What am I missing?
Attack of the poor API docs! Paypal sure tried hard, but they fall short. I've fought this API and won! :)
Change these values in what you already have... let me know if it takes care of the problem
&PAYMENTREQUEST_0_PAYMENTACTION=Sale [[ <--- payment action ]]
&PAYMENTREQUEST_0_CURRENCYCODE=EUR [[<-- currency code]]
&PAYMENTREQUEST_0_ITEMAMT=5.39 [[<---- subtotal here]]
&PAYMENTREQUEST_0_TAXAMT=1.08 [[<---- tax here]]
&PAYMENTREQUEST_0_SHIPPINGAMT=0.00 [[<---- shipping here]]
&PAYMENTREQUEST_0_AMT=6.47 [[<---- grand total here]]
&PAYMENTREQUEST_0_ALLOWNOTE=1
This one bugged me as well for a couple of days.
Using the Java SDK from developer.paypal.com (as of 2008), I finally came across a new version of the SDK (Nov 2011) at https://www.x.com/developers/paypal/documentation-tools/sdk#3
Using the new SDK (in particular, the updated paypal_base.jar) however did NOT yet solve my issue.
You have to figure out the correct API Version String to make it run. With version "51.0" (as in some of my example code), the call failed. As with version "78.0", the new SDK did the job.
Cheerio....
In addition to the other comments here, be sure to use the undocumented "useraction" option when you redirect to PayPal after getting the response from SetExpressCheckout:
?cmd=_express-checkout&useraction=commit&token=the-returned-token
(the link below no longer works)
Here's the PayPal forum reference to this parameter