2014-10-30 48 views
1

我使用的是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>  
+0

我認爲這個問題是不完整/不清楚的,你在下面的評論中說你現在使用PDT,你應該用這個信息更新問題。請注意,您可以並可能應該實施BOTH IPN和PDT,如[此處]所述(https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNPDTAnAlternativetoIPN/)。還請指定您正在使用的編程語言(PHP可能?)併爲其添加標籤,因爲這會增加獲得響應的機會。你在使用Sandbox進行測試嗎? – bg17aw 2016-01-18 12:59:20

+0

請張貼一些代碼。用於實現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

回答

1

return_url沒有收到任何付款/ IPN信息。通常它應該只是一個顯示「謝謝,再來」的靜態頁面。

您應該使用notify_url驗證IPN消息。您需要發送收到的付款數據,確切地說與收到的相同。如果您在良好的請求中收到INVALID錯誤,則應該仔細檢查您獲取請求的編碼,使用php存儲併發回。您可以使用PayPal PHP SDK確認付款代碼。

請注意IPN在訂閱用戶註冊,支付處理等方面發送了一堆消息。

+0

感謝您的幫助。在論壇中,我被建議使用PDT來處理返回流量。這就是我所做的。我的系統仍然在後端記錄IPN數據,接收subscr_signup和subscr_payment交易類型。但是爲了在付款後處理用戶,我現在使用PDT數據。它需要在Paypal帳戶中更新一些設置。然後,基於我的GET tx參數和我的祕密PDT令牌,我可以請求事務的完整數據。 https://developer.paypal.com/docs/classic/products/payment-data-transfer/ – 2014-10-31 04:06:55

+0

如果使用PDT,return_url可以收到付款信息(因爲它似乎是這種情況)。 – bg17aw 2016-01-18 13:01:30