来自return_url的Paypal IPN验证是无效的,但来自notify_url的是VERIFIED [英] Paypal IPN Verification from return_url is INVALID but from notify_url is VERIFIED

查看:52
本文介绍了来自return_url的Paypal IPN验证是无效的,但来自notify_url的是VERIFIED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Paypal订阅,标准网站按钮.因此,对于这个问题,payment_type是subscr_signup,用于为新用户创建用户帐户.我的HTML按钮表单的"notify_url"值设置为 http://domain.com/billing/ipn ,将返回"设置为 http://domain.com/billing/thankyou ,并将"rm"设置为到2

I am using Paypal subscription, standard website button. So for this question, the payment_type is subscr_signup, for creating user account for your new user. My HTML button form has values for "notify_url" set to http://domain.com/billing/ipn, "return" set to http://domain.com/billing/thankyou, and "rm" set to 2

这样,当某人完成付款时,他/他将连同POST中的IPN数据一起重定向到我们的谢谢"页面.收到.但是,当我通过贝宝(Paypal)进行验证时,我收到了无效的回复.现在,这很奇怪,我们也应该将数据获取到我们的IPN notify_url,对吗?我们做到了,但是这次,将其验证给Paypal会返回VERIFIED.

With this, when someone completes the payment, s/he will be redirected to our thank you page, along with the IPN data in POST. I got that. But when I verify it with Paypal, I got an INVALID response. Now, here's the strange thing, we should also get the data to our IPN notify_url, right? And we did, but this time, verifying it to Paypal returns VERIFIED.

我注意到发送的数据有些差异.

I notice some differences in the data that is sent.

RETURN谢谢页面的数据-无效(JSON格式)

Data for RETURN thank you page - INVALID (JSON-ified)

{
"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格式)

Data for NOTIFY_URL, backend IPN data - VERIFIED (JSON-ified)

{
"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按钮代码.

Since I do get expected response (VERIFIED or INVALID), I believe my verification code for Paypal IPN is correct. But just in case, here is my HTML button code.

            <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>     

推荐答案

return_url 没有收到任何付款/IPN信息.通常,它应该只是一个静态页面,显示谢谢,再次光临".

return_url do not recieve any payment/IPN information. Usually it should be just a static page which displays "Thank you, come again".

您应使用 notify_url 验证IPN消息.您需要以与接收邮件相同的方式完全发送已接收的付款数据.如果您在一个好的请求中收到INVALID错误,则应仔细检查获得请求的编码,将其存储在php中并发回.您可以使用 PayPal PHP SDK 来确定付款代码.

You should verify IPN messages with notify_url. You need to send recieved payment data exactly the same way it was recieved. If you recieve INVALID error on a good request, you should double check encoding in which you get the request, store in php and send back. You can use PayPal PHP SDK to be sure in the payment code.

请注意,IPN在订阅用户注册,付款处理等方面会发送一堆消息.

Please note IPN sends a bunch of messages on Subscription user registration, payment processing and so on.

这篇关于来自return_url的Paypal IPN验证是无效的,但来自notify_url的是VERIFIED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆