-1

我正在使用 Paytabs 支付网关。使用其余 API 验证密钥提供所有参数,但 API 每次都在“缺少参数商人电子邮件”消息中返回。

 result = HTTParty.post("https://www.paytabs.com/apiv2/validate_secret_key",
   :body=>{merchant_email: params[:merchant_email],
           merchant_secretKey: params[:secret_key]}.to_json,
           :headers => { 'Content-Type' => 'application/json',
           'Accept' =>'application/json' } )    
          render :json => {:code=>345, :result => result}
4

2 回答 2

0

您可以在标头而不是正文中发送参数吗?

像这样:

     headers = { 
        "key"  => "8781974720909019987" 
     }

     HTTParty.post(
         "https://www.acb.com/api/v2/market/LTC_BTC/",
          :headers => headers
      )
于 2018-05-24T06:08:14.427 回答
0

通过此过程解决问题。

url = URI.parse('https://www.paytabs.com/apiv2/validate_secret_key')        
data = {        
        :merchant_email=> params[:merchant_email],
        :secret_key=> params[:secret_key]       
        }
    x = Net::HTTP.post_form(url, data)
    render :json => eval(x.body)
于 2018-05-24T13:01:32.267 回答