Can't solve error, when sending Mass Pay call

420 views Asked by At

Hello I want to use Mass Pay API.

I'm using RubyOnRails. Here is my code:

    require 'httpclient'
    clnt = HTTPClient.new
    credentials = {
       'USER' => 'payer_1342623102_biz_api1.gmail.com',
       'PWD' => '1342623141',
       'SIGNATURE' => 'Ay2zwWYEoiRoHTTVv365EK8U1lNzAESedJw09MPnj0SEIENMKd6jvnKL'
     }

    data = {  
               "VERSION" => "2.3",
               "METHOD" => "MassPay",
               "RECEIVERTYPE" => "EmailAddress",
               "L_EMAIL0"=> "[email protected]",
               "L_AMT0" => "10",
               "L_EMAIL1"=> "[email protected]",
               "L_AMT1" => "5",
               "currencyCode" => "USD",
               "VERSION" => "51.0"}
    uri = "https://api-aa.sandbox.paypal.com/2.0/"
    res = clnt.post(uri, data)

puts res
puts res.header
puts res.content

and I get error:

       <SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Method not implemented</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envel

It is strange, because I di implement method in line "METHOD" => "MassPay".

Where is my problem ?

1

There are 1 answers

0
Denys Medynskyi On BEST ANSWER

Reason of my problem was in bad PayPal documentation. Here is code, that work:

    require 'httpclient'
    clnt = HTTPClient.new
    data = {    "METHOD" => "MassPay",
    "VERSION" => "90",
    'USER' => 'payer_1342623102_biz_api1.gmail.com',
    'PWD' => '1342623141',
    'SIGNATURE' => 'Ay2zwWYEoiRoHTTVv365EK8U1lNzAESedJw09MPnj0SEIENMKd6jvnKL',
    "RECEIVERTYPE" => "EmailAddress",
    "CURRENCYCODE" => "USD",
    "L_EMAIL0" => '[email protected]',
    "L_AMT0" => "1",
    "L_EMAIL1" => "[email protected]",
    "L_AMT1" => "1"
               }
    uri = "https://api-3t.sandbox.paypal.com/nvp"
    res = clnt.post(uri, data)