Search code examples
ruby-on-railspaypalpaypal-ipn

Paypal IPN doesn't tell me my order info


I successfully get the returns from Paypal IPN with the following parameters, however none of the parameters tell me which order I can find and update. The only possible parameters that might be helpful are payer_id, payer_email, mc_gross, but how if one payer buy the same item with the same amount? I should have something unique like token that generated when I setup the request to Paypal. I kept the token and I can use it to find the order when the transaction is completed and return to the return_url, but I don't have anything to match when IPN notify my notify_url. Please help, thank you.

By the way, I am using ruby on rails with a gem call paypal-express, which is working perfectly.

# Parameters: {"mc_gross"=>"200",
#              "protection_eligibility"=>"Ineligible",
#              "item_number1"=>"",
#              "payer_id"=>"JBZXYGAAHTZM2",
#              "tax"=>"0",
#              "payment_date"=>"08:32:00 Jan 23, 2014 PST",
#              "payment_status"=>"Pending",
#              "charset"=>"windows-1252",
#              "mc_shipping"=>"0",
#              "mc_handling"=>"0",
#              "first_name"=>"cc",
#              "notify_version"=>"3.7",
#              "custom"=>"",
#              "payer_status"=>"verified",
#              "num_cart_items"=>"1",
#              "mc_handling1"=>"0",
#              "verify_sign"=>"AFcWxV21C7fd0v3bYYYRCpSSRl31Am7YqqMX.kAbxBd9q1REIIsXe8T3",
#              "payer_email"=>"[email protected]",
#              "mc_shipping1"=>"0",
#              "tax1"=>"0",
#              "txn_id"=>"6SC87240NB740832W",
#              "payment_type"=>"instant",
#              "payer_business_name"=>"cc Tester's Test Store",
#              "last_name"=>"Tester",
#              "item_name1"=>"\u001A\u001A\u001A",
#              "receiver_email"=>"[email protected]",
#              "quantity1"=>"1",
#              "receiver_id"=>"3FBXQZPB9QZ9U",
#              "pending_reason"=>"multi_currency",
#              "txn_type"=>"cart",
#              "mc_gross_1"=>"200",
#              "mc_currency"=>"TWD",
#              "residence_country"=>"AU",
#              "test_ipn"=>"1",
#              "transaction_subject"=>"Japser Paypal\u001A\u001A",
#              "payment_gross"=>"",
#              "ipn_track_id"=>"58f7731e250a9"}

Solution

  • You can include an invoice ID in the payment info that you can use to track your internal invoice (or record) ID. That would then be passed back in IPN so you could use it to update your database accordingly.

    Are you using the PayPal shopping cart or are you using a custom cart of some sort? If you're working with Payments Standard you would just add the "invoice" parameter to your HTML form code. If you're working with the API's it would be the INVNUM field (in most of them, anyway).