开发者

How to implement Paypal callbacks in Rails? (Getting InvalidAuthenticityToken error)

Edit: This is a mostly Rails question

I'm trying to implement instant payment notification API (IPN), which calls your server if the Paypal payment goes through. The problem I'm seeing now is when Paypal IPN hits the url I designated, it is fail开发者_开发技巧ing with the following error:

> Started POST "/checkout/complete?id=1&amount=3445&authenticity_token=NkOwgJ1H2TEmwO6T+hROu96kWr4yGcTzHD6MbTswgyU="

> ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):

The authenticity_token it uses is the one I passed during the initial phase while redirecting to Paypal. Apparently, that's not a valid option. When I leave that blank, though, it's throwing the same error.

I wonder if I can disable authenticity_token requirement or get around it somehow, so that when Paypal posts to my app it can go through without any errors.


Sounds like the csrf is causing the issue, adding skip_before_filter :verify_authenticity_token to your controller should allow it to process.

If your using that authenticity_token as a security measure, then store and check it manually in your controllers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜