不能将承诺的价值返还给paypal按钮

I am trying to implement paypal express checkout on my website (Ubuntu 14.02 LAMP) with Codeigniter v2 and bespoke php. I have chosen the server implementation model where I am responsible for returning the payment id to paypal (to create the payment). However, even though I am happy that I can return a json structure of the form {"payToken":"token_value"} from my php functions, the paypal checkout.js keeps on saying my first character is a '<', and the window just dies. I can only assume somehow I am returning HTML but simply cannot find the problem. Am I missing some important detail about how I code the return value to the function when the button js script code in my html is as follows:

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

This is copied from paypals guides and my create function returns the json as above.

Any help would be really apperciated as I have spent weeks going nowhere.

Thanks, Paul