2014-09-10 95 views
2

我正在構建一個涉及paypal訂閱的asp.net web應用程序。我需要檢查用戶是否已經取消登錄是可能的,如果是的話如何?我已經看到關於這個主題的其他帖子,但我的情況是不同的,因爲我會檢查登錄。我在想,也許我可以每晚從PayPal批量轉儲數據,並檢查這些數據,以便爲取消的用戶設置標誌。不知道這是做什麼最好的辦法..檢測paypal訂閱取消登錄asp.net

+1

你檢查貝寶IPN?即時付款通知 - 您會收到有關您的付款請求和訂閱操作的任何事件的通知。您需要一個回調網址,讓您的服務根據訊息監聽通知並進行處理。因此,您不需要在登錄時檢查訂閱狀態,因爲只要用戶取消該訂閱即可取消訂閱。這不是100%的解決方案,但非常接近。 https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/ – Biri 2014-09-13 08:10:43

回答

3

如果你想檢查用戶登錄到貝寶後是否接受或取消協議,那麼是的,你可以通過使用快速結賬令牌來檢查這一點。您需要在買方登錄PayPal賬戶並在響應中查找變量BILLINGAGREEMENTACCEPTEDSTATUS後,在令牌上的API上調用GetExpressCheckoutDetails

BILLINGAGREEMENTACCEPTEDSTATUS = 0意味着買方不接受該協議或點擊登錄到支付寶賬戶後取消

BILLINGAGREEMENTACCEPTEDSTATUS = 1,表示在登錄到PayPal後點擊「同意並繼續」

我已經包含了一些示例響應。

拒絕後,日誌中:

NVP Response: 
TOKEN=EC-0RC04801KU663840M 
**BILLINGAGREEMENTACCEPTEDSTATUS=0** 
CHECKOUTSTATUS=PaymentActionNotInitiated 
TIMESTAMP=2014-09-14T14:54:43Z 
CORRELATIONID=5cc68231a1b35 
ACK=Success 
VERSION=109.0 
BUILD=12786467 
EMAIL=XXXXXXXXXXXXXX 
PAYERID=XXXXXXXXXXXX 
PAYERSTATUS=verified 
FIRSTNAME=Eshan Personal Test 
LASTNAME=Account 
COUNTRYCODE=US 
CURRENCYCODE=USD 
AMT=0.00 
SHIPPINGAMT=0.00 
HANDLINGAMT=0.00 
TAXAMT=0.00 
INSURANCEAMT=0.00 
SHIPDISCAMT=0.00 
PAYMENTREQUEST_0_CURRENCYCODE=USD 
PAYMENTREQUEST_0_AMT=0.00 
PAYMENTREQUEST_0_SHIPPINGAMT=0.00 
PAYMENTREQUEST_0_HANDLINGAMT=0.00 
PAYMENTREQUEST_0_TAXAMT=0.00 
PAYMENTREQUEST_0_INSURANCEAMT=0.00 
PAYMENTREQUEST_0_SHIPDISCAMT=0.00 
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false 
PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None 
PAYMENTREQUESTINFO_0_ERRORCODE=0 

驗收登錄後:

NVP Response: 
TOKEN=EC-1EX65013S71914041 
PHONENUM=408-767-7151 
**BILLINGAGREEMENTACCEPTEDSTATUS=1** 
CHECKOUTSTATUS=PaymentActionNotInitiated 
TIMESTAMP=2014-09-14T14:56:24Z 
CORRELATIONID=aae4de7a4b356 
ACK=Success 
VERSION=109.0 
BUILD=XXXXXXXXXXXXX 
PAYERID=XXXXXXXXXXXXXX 
PAYERSTATUS=verified 
FIRSTNAME=Eshan Personal Test 
LASTNAME=Account 
COUNTRYCODE=US 
SHIPTONAME=Eshan Personal Test Account 
SHIPTOSTREET=cxas 
SHIPTOSTREET2=asa 
SHIPTOCITY=FL 
SHIPTOSTATE=FL 
SHIPTOZIP=95616 
SHIPTOCOUNTRYCODE=US 
SHIPTOCOUNTRYNAME=United States 
ADDRESSSTATUS=Confirmed 
CURRENCYCODE=USD 
AMT=0.00 
SHIPPINGAMT=0.00 
HANDLINGAMT=0.00 
TAXAMT=0.00 
INSURANCEAMT=0.00 
SHIPDISCAMT=0.00 
PAYMENTREQUEST_0_CURRENCYCODE=USD 
PAYMENTREQUEST_0_AMT=0.00 
PAYMENTREQUEST_0_SHIPPINGAMT=0.00 
PAYMENTREQUEST_0_HANDLINGAMT=0.00 
PAYMENTREQUEST_0_TAXAMT=0.00 
PAYMENTREQUEST_0_INSURANCEAMT=0.00 
PAYMENTREQUEST_0_SHIPDISCAMT=0.00 
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false 
PAYMENTREQUEST_0_SHIPTONAME=Eshan Personal Test Account 
PAYMENTREQUEST_0_SHIPTOSTREET=cxas 
PAYMENTREQUEST_0_SHIPTOSTREET2=asa 
PAYMENTREQUEST_0_SHIPTOCITY=FL 
PAYMENTREQUEST_0_SHIPTOSTATE=FL 
PAYMENTREQUEST_0_SHIPTOZIP=95616 
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=US 
PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME=United States 
PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed 
PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None 
PAYMENTREQUESTINFO_0_ERRORCODE=0 
+0

感謝您的信息! – 2014-09-16 15:37:39