Skip to content
nov matake edited this page May 23, 2011 · 4 revisions

Debugging

Use PayPal Sandbox

Call Paypal.sandbox! at first.

Raw HTTP Request/Response

Since all request/response is via SSL, you can’t use usual TCP tracking tools like tcpflow.
If you need to do so, this code will help you.

In this code,

  • method is RPC method (SetExpressCheckout etc.), not HTTP method.
  • params is request body parameters except for METHOD parameter.
  • response is response body parameters.
module Paypal
  module NVP
    class Request
      def post_with_debugger(method, params = {})
        response = post_without_debugger(method, params)
        puts <<-DEBUG
#{method}
==========
#{params.to_query}
----------
#{response}
==========

DEBUG
        response
      end
      alias_method_chain :post, :debugger
    end
  end
end
Clone this wiki locally