我使用的是Paypal订阅,标准网站按钮。因此,对于这个问题,payment_type是subscr_signup,用于为您的新用户创建用户帐户。我的HTML按钮的形式有值“notify_url”设置为http://domain.com/billing/ipn,“回归”设置为http://domain.com/billing/thankyou,和“RM”设置为2PayPal从return_url的IPN验证是无效的,但从notify_url被验证
这样,当用户完成付款后,他/她将被重定向到我们的感谢您的页面以及POST中的IPN数据。我明白了。但是,当我用PayPal验证它时,我收到了INVALID响应。现在,这里有一件奇怪的事情,我们也应该将数据传给我们的IPN notify_url,对吧?我们做了,但这一次,验证它贝宝返回VERIFIED。
我注意到发送的数据有一些差异。
数据RETURN感谢页面 - 无效(JSON-指明分数)
{
"txn_type": "subscr_signup",
"subscr_id": "I-HHTJ0ANUHKRU",
"last_name": "Ismail",
"residence_country": "CA",
"mc_currency": "USD",
"item_name": "Individual eStudio Plan",
"business": "[email protected]",
"amount3": "99.00",
"recurring": "1",
"address_street": "1 Maire-Victorin",
"payer_status": "verified",
"payer_email": "[email protected]",
"address_status": "confirmed",
"first_name": "Iszuddin",
"receiver_email": "[email protected]",
"address_country_code": "CA",
"payer_id": "LYRHTKFEH45M8",
"address_city": "Toronto",
"reattempt": "1",
"item_number": "IND",
"address_state": "Ontario",
"subscr_date": "22:52:19 Oct 29, 2014 PDT",
"address_zip": "M5A 1E1",
"charset": "windows-1252",
"period3": "1 Y",
"address_country": "Canada",
"mc_amount3": "99.00",
"address_name": "Iszuddin Ismail",
"auth": "AUjfQ4uRNLr22YfSNPGR1YLm5w81cYyFjf9PEu7mVGSLTp2cFD67opAIXJ-Dtsnw4KEXlF0Y268Ks9VmrwpDRrg",
"form_charset": "UTF-8"
}
数据NOTIFY_URL,后端IPN数据 - 恪(JSON-指明分数)
{
"txn_type": "subscr_signup",
"subscr_id": "I-HHTJ0ANUHKRU",
"last_name": "Ismail",
"residence_country": "CA",
"mc_currency": "USD",
"item_name": "Individual eStudio Plan",
"business": "[email protected]",
"amount3": "99.00",
"recurring": "1",
"address_street": "1 Maire-Victorin",
"verify_sign": "Ajiy6YmBz00sV0oT2S-obuaQ3kehAQO0-T8GJFKpiQnaRzRv7.oJ5Eqy",
"payer_status": "verified",
"test_ipn": "1",
"payer_email": "[email protected]",
"address_status": "confirmed",
"first_name": "Iszuddin",
"receiver_email": "[email protected]",
"address_country_code": "CA",
"payer_id": "LYRHTKFEH45M8",
"address_city": "Toronto",
"reattempt": "1",
"item_number": "IND",
"address_state": "Ontario",
"subscr_date": "22:52:19 Oct 29, 2014 PDT",
"address_zip": "M5A 1E1",
"charset": "windows-1252",
"notify_version": "3.8",
"period3": "1 Y",
"address_country": "Canada",
"mc_amount3": "99.00",
"address_name": "Iszuddin Ismail",
"ipn_track_id": "698ae88a36ef9"
}
因为我得到预期响应(VERIFIED或INVALID),我相信我的Paypal IPN的验证码是正确的。但为了以防万一,这里是我的HTML按钮代码。
<form action="<?php echo $this->url?>" method="post" name="ppform">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="<?php echo $this->paypal_email; ?>">
<input type="hidden" name="item_name" value="<?php echo $selected_plan['name'] ?>">
<input type="hidden" name="item_number" value="<?php echo $selected_plan['code'] ?>">
<input type="hidden" name="a3" value="<?php echo $selected_plan['price']; ?>"> <!-- subscription price -->
<input type="hidden" name="p3" value="1"> <!-- rebill every x value -->
<input type="hidden" name="t3" value="<?php echo $selected_plan['recurring_period'] ?>"> <!-- interval M=month/W=week/Y=year -->
<input type="hidden" name="src" value="1"> <!-- Is this recurring 1=yes/0=no -->
<input type="hidden" name="currency_code" value="<?php echo $selected_plan['currency'] ?>">
<!-- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> -->
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="<?php echo site_url('billing/ipn') ?>">
<input type="hidden" name="return" value="<?php echo site_url('billing/thankyou') ?>">
</form>
我认为这个问题是不完整/不清楚的,你在下面的评论中说你现在使用PDT,你应该用这个信息更新问题。请注意,您可以并可能应该实施BOTH IPN和PDT,如[此处]所述(https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNPDTAnAlternativetoIPN/)。还请指定您正在使用的编程语言(PHP可能?)并为其添加标签,因为这会增加获得响应的机会。你在使用Sandbox进行测试吗? – bg17aw 2016-01-18 12:59:20
请张贴一些代码。用于实现IPN的示例代码(PHP,.Net,Coldfusion等)[here](https://github.com/paypal/ipn-code-samples),实现PDT的示例代码[here](https:// github。 com/paypal/pdt-code-samples) – bg17aw 2016-01-18 13:09:22