Question

PayPal NVP Partial refunds refunding full amount though specified the RefundType as "Partial"

Here is the request i am using

    public string Refund_Partial(string transactionID, string refundType,string Amount)
    {
        string strCredentials = "USER=" + strUsername + "&PWD=" + strPassword + "&SIGNATURE=" + strSignature;
        string strNVP = strCredentials;
        strNVP += "&METHOD=RefundTransaction&VERSION=" + strAPIVersion;

        strNVP += "&TRANSACTIONID=" + transactionID + "&REFUNDTYPE=" + refundType + "¤cy=USD" + "&AMOUNT=" + Amount;
        //Create web request and web response objects, make sure you using the correct server (sandbox/live)
        HttpWebRequest wrWebRequest = (HttpWebRequest)WebRequest.Create(strNVPSandboxServer);
        //Set WebRequest Properties
        wrWebRequest.Method = "POST";
        // write the form values into the request message
        StreamWriter requestWriter = new StreamWriter(wrWebRequest.GetRequestStream());
        requestWriter.Write(strNVP);
        requestWriter.Close();
        // Get the response.
        HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();
        StreamReader responseReader = new StreamReader(wrWebRequest.GetResponse().GetResponseStream());
        // and read the response
        string responseData = responseReader.ReadToEnd();
        responseReader.Close();
        return responseData;
    }

Can anyone please let me know do i need to include more parameters to do a partial refund?

Was it helpful?

Solution

Can you change the Parameters value for currencyCode and Amount, From

"¤cy=USD" + "&AMOUNT=" + Amount

to

"CURRENCYCODE=USD" + "&AMT=" + Amount

Have a look at RefundTransaction API Operation (NVP).

May be PayPal is looking for AMT parameter which is not there, which is why it is refunding in Full

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top