CodeIgniter Forums
Paypal confusion - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Paypal confusion (/thread-6616.html)



Paypal confusion - El Forum - 03-05-2008

[eluser]kaosweaver[/eluser]
OK, I've got my own paypal solution - modeled after a working cart I built - that I've copied over to my CI install.

I'm able to get to Paypal with the cart contents and all - I'm just not able to get Paypal to respond and work with CI.

Paypal returns:

http://www.mydomain.com/?mc_gross=119.00&invoice=12&address_status=confirmed&item;_ ...

and I can't seem to get past this error:

The URI you submitted has disallowed characters.

I've turned on the IPN on Paypal (first pointing to a controller for handling, then to a file exempt from the URL rewrite)
I've set the notification URL to match the IPN URL in Paypal.

I scrapped everything and tried the library (and applied the two code fixes and still wasn't able to get it to work)

I've looked all over the forum to try and figure this out - but as soon as the paypal returns anything, I get the above error, hopefully I've just missed/forgot/etc some easy switch somewhere to make this all work cause it is a pain to try and figure it out

One suggestion to CI - when this error happens, it would be NICE if the logs would give me something meaningful to troubleshoot it as I've got logs on max reporting and it doesn't even mention this event...


Paypal confusion - El Forum - 03-05-2008

[eluser]CI Lee[/eluser]
Hey...

In line 126 of config/config.php you will see
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

Try adding the & and other characters that PayPal returns....

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-&';

Hope that helps

-Lee


Paypal confusion - El Forum - 03-06-2008

[eluser]adamp1[/eluser]
This shouldnt be a problem. When I used PayPal I made it return the data in a POST variable. Then you have no problems. Are you using the PayPal Library from the wiki?


Paypal confusion - El Forum - 03-06-2008

[eluser]kaosweaver[/eluser]
[quote author="adamp1" date="1204812446"]This shouldnt be a problem. When I used PayPal I made it return the data in a POST variable. Then you have no problems. Are you using the PayPal Library from the wiki?[/quote]

How do you make Paypal return in a POST?

Yes, I tried the library, I got errors that I didn't have time to fix. I'm not done yert, but I used another, non-CI library which completed a transaction (so I could remove any issues that may have been server or Paypal related as to getting this to work).

I'd love to get it all working nice and the Paypal POST would be great - as that would eliminate the URL error message, so, any hints on how to do that?


Paypal confusion - El Forum - 03-06-2008

[eluser]adamp1[/eluser]
I just used the one off the wiki, worked fine. Make sure you check the updates posted on the wiki and make the changes in the code. The updates are due to a misunderstanding of $this->input->post works.

It says right in the PayPal Variable documentation:
Quote:Return URL behavior. If set to "1" and if a "return" value is submitted, upon completion of the payment the buyer will be sent back to the return URL using a GET method, and no transaction variables will be submitted. If set to "2" and if a "return" value is submitted, the buyer will be sent back to the return URL using a POST method, to which all available transaction variables will also be posted. If omitted or set to "0", GET methods will be used for all Subscriptions transactions and Buy Now, Donations, or PayPal Shopping Cart transactions in which IPN is not enabled. POST methods with variables will be used for the rest.

So to your paypal form you need to add a field
Code:
<input type="hidden" name="rm" value="2">

That will return the data in POST form.

I would advice you go and read the documentation in the Integration Center before continuing. There is all the information you need there to setup PayPal transactions.


Paypal confusion - El Forum - 03-06-2008

[eluser]kaosweaver[/eluser]
[quote author="adamp1" date="1204842263"]
Code:
<input type="hidden" name="rm" value="2">

That will return the data in POST form.[/quote]

That was what was throwing me, I hadn't needed the return to be a POST until now and the documentation I'd been reading from the Paypal developer forum said that the default was a POST return. I'm on my code, with the round trip from Paypal as I set that anyway, just cleaning up some stuff - wanted to make sure I was totally done before I came back here to post notice.

thanks.