0

您好,我想使用 Mass Pay API。

我正在使用 RubyOnRails。这是我的代码:

    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"=> "denmed_1342691273_biz@gmail.com",
               "L_AMT0" => "10",
               "L_EMAIL1"=> "second_1344932945_per@gmail.com",
               "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

我得到错误:

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

这很奇怪,因为我在“METHOD”=>“MassPay”行中实现了方法。

我的问题在哪里?

4

1 回答 1

0

我的问题的原因是糟糕的 PayPal 文档。这是代码,可以工作:

    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" => 'propro_1344939908_biz@gmail.com',
    "L_AMT0" => "1",
    "L_EMAIL1" => "denmed_1342691273_biz@gmail.com",
    "L_AMT1" => "1"
               }
    uri = "https://api-3t.sandbox.paypal.com/nvp"
    res = clnt.post(uri, data)
于 2012-08-15T07:43:27.030 回答