paypalpaypal-nvpnvp

Get refund transaction details with PayPal NVP


Is it possible to retrieve refund details such as the parent transaction ID with the PayPal NVP API? So far I know it's possible to retrieve the details of a "Received" transaction by using "GetTransactionDetails" but for refunds it seems that method doesn't work.

  body = {
     USER: user_id, 
     PWD: password, 
     SIGNATURE: signature,
     METHOD: 'GetTransactionDetails',
     TRANSACTIONID: refund_id
     VERSION: 204
  }

  response = HTTParty.post('https://api-3t.sandbox.paypal.com/nvp', body: body).

  #Parsed response:

  {
     "ADDRESSOWNER"=>"PayPal", "ADDRESSSTATUS"=>"None", 
     "TIMESTAMP"=>"2018-03-15T11:04:45Z", 
     "CORRELATIONID"=>"97e8f9e1e9921", "ACK"=>"Failure", 
     "VERSION"=>"204", "BUILD"=>"39949200", "L_ERRORCODE0"=>"10004", 
     "L_SHORTMESSAGE0"=>"Invalid transaction type", 
     "L_LONGMESSAGE0"=>"You can not get the details for this type of transaction", 
     "L_SEVERITYCODE0"=>"Error", 
     "PENDINGREASON"=>"None",
     "REASONCODE"=>"None",
     "L_TAXABLE0"=>"false"
  } 

Solution

  • I've tested it again with another refund ID and I think my example from above failed as refunds for PayPal fees cannot be retrieved. Regular refunds can be retrieved with the GetTransactionDetails.