1

I am Trying to Pay users with Paypal MassPay API from my website.

public function PPHttppost($methodName,$nvpstr){
        $setting = $this->globalsetting();
        // Set up your API credentials, PayPal end point, and API version.
        $API_Username = $setting->paypal_api_username;
        $API_Password = $setting->paypal_api_password;
        $API_Signature = $setting->paypal_api_signature;
        $API_Environment = $setting->paypal_mode;

        $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
        $API_Version = '116.0';
        if('sandbox' === $API_Environment || 'beta-sandbox' === $API_Environment){
            $API_Endpoint = "https://api-3t.$API_Environment.paypal.com/nvp";
        }
        $version = urlencode($API_Version);
        //set curl paramaeter
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);

        //Turn of server and pakagemanager
        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, 1);

        //set the API operation,version,API signature in requrest

        $nvpreq = "METHOD=$methodName&VERSION=$version&PWD=$API_Password&USER=$API_Username&SIGNATURE=$API_Signature&$nvpstr";
        //set the request as POST field for curl
        curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

        //get the response from server

        $httpResponse = curl_exec($ch);

        if(!$httpResponse){
            exit("$methodName failed:".curl_error($ch).'('.curl_errno($ch).')');
        }

        //Extract the response details

        $httpResponseArray = explode('&', $httpResponse);

        $httpParsedResponseArray = array();

        foreach ($httpResponseArray as $i=>$value){
            $tmpArray = explode('=', $value);
            if(sizeof($tmpArray) > 1){
                $httpParsedResponseArray[$tmpArray[0]] = $tmpArray[1];
            }
        }
        if((0 == sizeof($httpParsedResponseArray)) || !array_key_exists('ACK',$httpParsedResponseArray)){
            exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
        }
        return $httpParsedResponseArray;
    }

$nvpstr = "RECEIVERTYPE=EmailAddress&EMAILSUBJECT=Your withdraw request was processed&L_EMAIL0=seller@gmail.com&L_AMT0=$amt&CURRENCYCODE=$currency";

public function doMassPay($nvpstr){
    $httpParsedResponseArray = $this->PPHttppost('MassPay', $nvpstr);
    pr($httpParsedResponseArray);exit;
    }

When, I call MassPay api of paypal , it returns me success

Array
(
    [TIMESTAMP] => 2014%2d09%2d12T07%3a18%3a12Z
    [CORRELATIONID] => c4c61215cdd72
    [ACK] => Success
    [VERSION] => 116%2e0
    [BUILD] => 12786467
)

but when I check my account log, it shows receptitant was unable to accept ammount, transaction was denied.

I checked it with different test account, everytime it returns same response. Can anyone guide me where and what I am doing wrong? I am using cakephp framwork and using no library for calling Paypal API.

user3873381
  • 55
  • 11
  • Kindly make sure that the account from which the mass payment is sent is verified . – Eshan Sep 12 '14 at 11:55
  • That account shows verified – user3873381 Sep 12 '14 at 12:50
  • Can you post the sandbox account email address here ? – Eshan Sep 12 '14 at 14:30
  • krutarth.softqube@gmail.com – user3873381 Sep 15 '14 at 04:42
  • 1
    It seems that You are trying to send the mass payments from "krutarth123@gmail.com" which is an unverified sandbox account and causing the payments to get denied . I have verified your sandbox account at our end manually , can you try to make the mass payment now? – Eshan Sep 15 '14 at 13:48
  • Yes, it works now :) Thank you very much for help. but can you please tell me how you verified that account?? just for future help :) – user3873381 Sep 16 '14 at 04:33
  • 1
    Actually I manually verified the account as I am in PayPal support. Generally to verify the sandbox account , you need to select option "Bank Verified -- Yes" while creating the sandbox account on developer.paypal.com . – Eshan Sep 17 '14 at 03:58

0 Answers0