您需要做的是创建您自己的 IPN 模拟器来测试它。您可以制作一个基本的 HTML 表单,将操作设置为您的 IPN URL 和隐藏字段,这些字段与您希望从 IPN 获得的名称/值相匹配。
这样您就可以在浏览器中加载您的测试并将其提交给您的 IPN 监听器。您将能够在屏幕上看到有助于排除故障的结果。
请记住,以这种方式进行测试时,数据并非来自 PayPal 服务器,因此 IPN 将未经验证。您需要确保您的代码逻辑能够处理该问题。
以下是发生退款时您会获得的 IPN 的一些示例,因此您可以了解您应该期待什么并相应地设置您的模拟器。
新案例
txn_type = new_case
payment_date = 13:40:52 Aug 05, 2013 PDT
case_id = PP-002-576-509-683
receipt_id = 4674-2219-3481-3741
case_type = chargeback
business = payments@domain.com
verify_sign = AeD56uUedZzgp83xxTHMkZtMZ9FVAzvpMwl6OHUf9CNvlvgA2P0mbcwP
payer_email = 9FE47613HE5558457@dcc.paypal.com
txn_id = 0PC8014855508203X
case_creation_date = 18:40:23 Sep 04, 2013 PDT
receiver_email = payments@domain.com
payer_id = RZ3LX555U646Q
receiver_id = M5VRA555CSK6
reason_code = non_receipt
custom =
charset = windows-1252
notify_version = 3.7
ipn_track_id = 2842c24f40ac
反转
mc_gross = -1972.86
protection_eligibility = Ineligible
payer_id = RZ3LX555U646Q
address_street = N/A
payment_date = 18:42:00 Sep 04, 2013 PDT
payment_status = Reversed
charset = windows-1252
address_zip = 00000
first_name = Tester
mc_fee = -44.74
address_country_code = US
address_name = Tester Testerson
notify_version = 3.7
reason_code = chargeback
custom =
business = payments@usbswiper.com
address_country = United States
address_city = NA
verify_sign = Ai1PaghZh5FmBLCDCTQpwG8jB264ABWpa3tbhFljkaPnVj1L9ip5EwyS
parent_txn_id = 0PC8014555008203X
txn_id = 0PC8014855508203X
payment_type = instant
last_name = Testerson
address_state = NA
receiver_email = payments@domain.com
payment_fee = -44.74
receiver_id = M5VRA555CSK6
item_name = PayPal POS Web Order
mc_currency = USD
item_number =
residence_country = US
receipt_id = 4674-2219-3481-3741
handling_amount = 0.00
transaction_subject =
payment_gross = -1972.86
shipping = 100.00
ipn_track_id = f456d076de1ff
我是一名优秀的程序员,十分优秀!