Paypal提供GetTransactionDetails
API调用以获取交易的交易状态。但它需要TRANSACTIONID
作为强制参数,这是Paypal为此交易分配的交易ID。
付款完成后,Paypal会返回此TRANSACTIONID
。但是在客户进行支付并返回商家页面并且网络中断的情况下,商家将无法获得支付状态以及PayPal的交易ID。商家如何能够在以后使用API调用获得交易?有没有办法使用商家的交易ID获取状态?
答案 0 :(得分:1)
您可以在变量“INVNUM”中传递您自己的发票ID,然后运行“TransactionSearch”API以通过传递“INVNUM”来获取详细信息,该“INVNUM”将为您提供PayPal的交易ID的响应(如果交易将是走了)。
一旦获得PayPal的交易ID,请运行“GetTransactionDetails”API以获取详细信息。我已经在第一个api中包含了示例请求和响应,我使用自己的invnum来获取详细信息,然后使用PayPal的txn id作为响应,我获取了完整的详细信息。
NVP Request:
USER=us-XXXX&PWD=XXXX&SIGNATURE=XXXX&VERSION=109.0&METHOD=TransactionSearch&STARTDATE=2015-08-08T00:00:00Z&TRANSACTIONCLASS=All&INVNUM=MyOWNID123456
NVP Response:
L_TIMESTAMP0=2015-08-20T16:43:10Z
L_TIMEZONE0=GMT
L_TYPE0=Payment
L_NAME0=John Test
L_TRANSACTIONID0=33407257W5286551J
L_STATUS0=Completed
L_AMT0=0.01
L_CURRENCYCODE0=USD
L_FEEAMT0=-0.01
L_NETAMT0=0.00
TIMESTAMP=2015-08-20T16:44:22Z
CORRELATIONID=7247ad390a76
ACK=Success
VERSION=109.0
BUILD=000000
NVP Request:
USER=XXXX&PWD=XXXX&SIGNATURE=XXX&VERSION=109.0&METHOD=GetTransactionDetails&TRANSACTIONID=33407257W5286551J
NVP Response:
RECEIVERBUSINESS=XXXXX
RECEIVEREMAIL=XXXXXX
RECEIVERID=XXXXX
PAYERID=RPP8F58J274JG
PAYERSTATUS=unverified
COUNTRYCODE=US
ADDRESSOWNER=PayPal
ADDRESSSTATUS=None
INVNUM=MyOWNID123456
SALESTAX=0.00
SHIPAMOUNT=0.00
SHIPHANDLEAMOUNT=0.00
TIMESTAMP=2015-08-21T04:03:50Z
CORRELATIONID=db0509e83df7c
ACK=Success
VERSION=109.0
BUILD=000000
FIRSTNAME=John
LASTNAME=Test
TRANSACTIONID=33407257W5286551J
RECEIPTID=5098-8700-1518-0878
TRANSACTIONTYPE=webaccept
PAYMENTTYPE=instant
ORDERTIME=2015-08-20T16:43:10Z
AMT=0.01
FEEAMT=0.01
TAXAMT=0.00
CURRENCYCODE=USD
PAYMENTSTATUS=Completed
PENDINGREASON=None
REASONCODE=None
PROTECTIONELIGIBILITY=Ineligible
PROTECTIONELIGIBILITYTYPE=None
L_QTY0=1
L_TAXAMT0=0.00
L_CURRENCYCODE0=USD
L_TAXABLE0=false