【发布时间】:2014-12-26 02:27:19
【问题描述】:
我正在使用 Paypal 订阅,标准网站按钮。所以对于这个问题,payment_type 是 subscr_signup,用于为您的新用户创建用户帐户。我的 HTML 按钮表单的“notify_url”值设置为http://domain.com/billing/ipn,“return”设置为http://domain.com/billing/thankyou,“rm”设置为 2
这样,当有人完成付款时,他/她将被重定向到我们的感谢页面,以及 POST 中的 IPN 数据。我明白了。但是当我用 Paypal 验证它时,我得到了一个无效的响应。现在,奇怪的是,我们也应该将数据发送到我们的 IPN notify_url,对吧?我们做到了,但这一次,向 Paypal 验证它会返回 VERIFIED。
我注意到发送的数据存在一些差异。
返回感谢页面的数据 - 无效(JSON 化)
{
"txn_type": "subscr_signup",
"subscr_id": "I-HHTJ0ANUHKRU",
"last_name": "Ismail",
"residence_country": "CA",
"mc_currency": "USD",
"item_name": "Individual eStudio Plan",
"business": "business@kengkawan.com",
"amount3": "99.00",
"recurring": "1",
"address_street": "1 Maire-Victorin",
"payer_status": "verified",
"payer_email": "customer@kengkawan.com",
"address_status": "confirmed",
"first_name": "Iszuddin",
"receiver_email": "business@kengkawan.com",
"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": "business@kengkawan.com",
"amount3": "99.00",
"recurring": "1",
"address_street": "1 Maire-Victorin",
"verify_sign": "Ajiy6YmBz00sV0oT2S-obuaQ3kehAQO0-T8GJFKpiQnaRzRv7.oJ5Eqy",
"payer_status": "verified",
"test_ipn": "1",
"payer_email": "customer@kengkawan.com",
"address_status": "confirmed",
"first_name": "Iszuddin",
"receiver_email": "business@kengkawan.com",
"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"
}
由于我确实收到了预期的响应(已验证或无效),我相信我的 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,您应该使用此信息更新问题。请注意,您可以并且也许应该同时实现 IPN 和 PDT,如 here 所述。还请指定您使用的编程语言(也许是 PHP?)并为此添加标签,因为它会增加您获得响应的机会。您是否使用沙盒进行测试?
标签: paypal paypal-ipn