jasl / wx_pay

An unofficial simple wechat pay gem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always {"return_code"=>"FAIL", "return_msg"=>"签名错误"}

pohodnya opened this issue · comments

Hello, I need a problem with trade_type: NATIVE. I always get Signature error.

What can be wrong?

def get_qr_code_url
  r = WxPay::Service.invoke_unifiedorder params
  raise r['return_msg'] if r['return_code'] == 'FAIL'
  r['code_url']
end

private
def params
  {
      body: "Payment for invoice ##{@invoice.number}",
      out_trade_no: @payment.id.to_s,
      spbill_create_ip: '127.0.0.1',
      total_fee: 1,
      notify_url: notify_url,
      trade_type: 'NATIVE'
  }
end

Hi, I suggest you confirm related configuration both on wechat administration site and your app first.

I run into same problem, finally i found param type must be right, the following is my error

wrong: total_amount: 1000.0
right: total_amount: 1000

you're right, I checked my work's code, the price should be presented as cent, that should be told at Wechat pay's docs.

I'm closing the issue