Problems trying to implement Refunds with Paypal Refund API

danceraccess
Member
Member

We have a webapp that uses Paypal to process transactions. The button links out to Express Checkout then redirects back to the web app. In the admin we are trying to setup a button than can refund the catalogued transactions.

 

 

We used this link https://developer.paypal.com/docs/classic/express-checkout/ht_basicRefund-curl-etc/.

 

CURL

 

We have tried both method SOAP or curl with a sandbox account and we keep getting the same error.

 

With curl we are using this code:

 

<?php

                                   $fields= array(
                                       'METHOD' => urlencode('RefundTransaction'),
                                       'VERSION' => urlencode('94'),
                                       'PWD' => urlencode('password'),
                                       'USER' => urlencode('user_api1.gmail.com'),
                                       'SIGNATURE' => urlencode('...'),
                                       'TRANSACTIONID' => urlencode('...'),
                                       'REFUNDTYPE' => urlencode('Full'),
                                       'REFUNDSOURCE' => urlencode('instant')
                                   );
                                   $fields_string=null;
                                   foreach($fields as $key=>$value) {
                                       $fields_string .= $key.'='.$value.'&';
                                   }
                                    rtrim($fields_string, '&');
                                   // create a new cURL resource
                                   $ch = curl_init();

                                   // set URL and other appropriate options
                                   curl_setopt($ch, CURLOPT_URL, "https://api-3t.sandbox.paypal.com/nvp");
                                   //curl_setopt($ch, CURLOPT_POST, 1);

                                   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                                   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
                                   //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

                                   curl_setopt($ch,CURLOPT_POST, count($fields));
                                   curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
                                   curl_setopt($ch, CURLOPT_HEADER, 0);

                                   // grab URL and pass it to the browser
                                   $retVal=curl_exec($ch);

                                   // close cURL resource, and free up system resources
                                   curl_close($ch);

                                   if(!$retVal)
                                       return array("ERROR_MESSAGE"=>"Refund Transaction failed".
                                           curl_error($ch)."(".curl_errno($curl_var).")");

                                   ?>

 

and we get this error:

 

TIMESTAMP=2017%2d01%2d19T06%3a45%3a48Z&CORRELATIONID=71ac6942d6daa&ACK=Failure&L_ERRORCODE0=10001&L_SHORTMESSAGE0=Internal%20Error&L_LONGMESSAGE0=Timeout%20processing%20request

 

 

SOAP

 

We tried using SOAP

 

 

<form method="post" action="https://api-3t.sandbox.paypal.com/2.0/">

                                   <input type="hidden" name="Username" value="user_api1.gmail.com">
                                   <input type="hidden" name="Password" value="...">
                                   <input type="hidden" name="Signature" value="...">
                                   <!--<input type="hidden" name="Subject" value="..">-->

                                   <input type="hidden" name="TransactionID" value="...">
                                   <input type="hidden" name="RefundType" value="Full">
                                   <input type="submit">
</form>

and we get this error

 

 

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ns="urn:ebay:api:PayPalAPI">
<SOAP-ENV:Header>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username xsi:type="xs:string">xxx</Username>
<Password xsi:type="xs:string">xxx</Password>
<Signature xsi:type="xs:string">xxx</Signature>
<Subject xsi:type="xs:string"/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body id="_0">
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Method not implemented</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

If anyone could tell us what is the proper way to setup refunds or why we get these errors that would be great. And yes we tried the proper credit card numbers, it's not that.

 

Thanks!

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.