简体   繁体   中英

Detecting paypal subscription cancel on login asp.net

I am building an asp.net web app that involves paypal subscriptions. I need to check if the user has cancelled on login is this possible and if so how? I have seen other posts on this subject but my situation is different since I'll be checking on login. I was thinking maybe I can do a batch dump of data from paypal nightly and check against that to set a flag on the users that cancelled. Not sure what the best way to do this is..

If you want to check whether the user has accepted or cancelled the agreement after logging to the PayPal then yes you can check this by using the Express Checkout Token . You need to call GetExpressCheckoutDetails API on the Token after the buyer log in to the PayPal account and look for the variable BILLINGAGREEMENTACCEPTEDSTATUS in the response .

BILLINGAGREEMENTACCEPTEDSTATUS=0 means buyer has not accepted the agreement or clicked on cancel after logging to the PayPal account .

BILLINGAGREEMENTACCEPTEDSTATUS=1 , means by has clicked on the "agree and continue" after logging to the PayPal .

I have included some sample response .

For rejection after log in :

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 

For acceptance after log in :

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM