• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PayPal button callback fails to get controllers return value

#1
I am trying to integrate a simple PayPal button for express checkout into my website. We are using Ubuntu 14.02 lamp with v2 cofeigniter. The PayPal button uses a .then function to asynchronously wait for a return value from a posted method call. I am certain that call works and returns a Json structure similar to {"payToken":"some value"} but the .then promised function never sees any data and the button dialog fails to open. Tracing complains about the first character being '<' suggestion either some html or perhaps a Php header. Is there something I have missed here within CI?
Sadly I can make no sense of what's wrong here in what at first sight seems quite simple. Any help much appreciated, Paul
Reply

#2
Is the callback a POST call back to your site from PayPal and are you using CSRF protection?
Reply

#3
csrf_protection is set to false in config.php

the code I am trying to debug is in one of our webpages as follows:

// Wait for the PayPal button to be clicked

payment: function() {

// Make a call to the merchant server to set up the payment

return paypal.request.post('/payment/create/').then(function(res) {
return res.payToken;
});
},
Reply

#4
the create is routed to the real function which returns the json as I described earlier
Reply

#5
Are you sure the create method is being called? Do you log any message or can you view the request via your console?
Reply

#6
As I said I trace the function progress and log values to a file so yes I am
Reply

#7
The console shows a success code of 200 so I think it's worked
Reply

#8
What is being printed to screen by the called method? A response of 200 does not mean an error did not occur

If the response starts with this '<'
then it is probably an error that is being returned and not the expected JSON
Reply

#9
Understood Martin thx for your patience. However when I look at the browser tools the create network/response tab says no data so I cannot see how to trap this potential error. I have suffered similar in the past so now run the script from the command line as a simple parse check. Should that be sufficient?
Reply

#10
Maybe you could share your code. Can't keep making guesses
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.