Paytabs 支付网关 Api 不工作

Paytabs payment gateway Api not working

我正在使用 Paytabs 支付网关。使用其余 API 验证密钥,每次在 "missing parameter merchant_email" 消息中提供所有参数但 API returns。

 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}

能否在 header 而不是 body 中发送参数?

像这样:

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

     HTTParty.post(
         "https://www.acb.com/api/v2/market/LTC_BTC/",
          :headers => headers
      )

通过此流程解决问题。

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)