项目作者: lihf8515

项目描述 :
WeChat payment SDK for Nim.
高级语言: Nim
项目地址: git://github.com/lihf8515/wxpay.git
创建时间: 2020-11-23T03:21:11Z
项目社区:https://github.com/lihf8515/wxpay

开源协议:MIT License

下载


wxpay

WeChat payment SDK for Nim.

已经实现的功能:

  1. 付款码支付
  2. 申请退款
  3. 统一下单
  4. 关闭订单
  5. 下载对账单
  6. 订单查询
  7. 退款申请查询
  8. 交易保障
  9. 撤销订单

注意:编译时请使用 -d:ssl 以开启ssl支持

下面是一个例子:

  1. import tables
  2. import wxpay
  3. var results = OrderedTable[string, string]()
  4. var input = OrderedTable[string, string]()
  5. var config = OrderedTable[string, string]()
  6. config["appid"] = ""
  7. config["appsecret"] = ""
  8. config["key"] = ""
  9. config["mch_id"] = ""
  10. config["notify_url"] = ""
  11. config["proxy_host"] = "0.0.0.0"
  12. config["proxy_port"] = "0"
  13. config["report_level"] = "1"
  14. config["sslcert_path"] = "cert/apiclient_cert.pem"
  15. config["sslkey_path"] = "cert/apiclient_key.pem"
  16. config["sign_type"] = "HMAC-SHA256"
  17. input["auth_code"] = "138728953980228598"
  18. input["body"] = "付款码支付测试"
  19. input["total_fee"] = "1"
  20. input["out_trade_no"] = "test00000001"
  21. try:
  22. if wxMicropay(input, config, results):
  23. echo "支付成功"
  24. echo results
  25. else:
  26. echo "支付失败"
  27. echo results
  28. except:
  29. echo wxErrorMessage()
  30. results.clear()
  31. input.clear()
  32. input["out_refund_no"] = "132564989589668"
  33. input["out_trade_no"] = "test00000001"
  34. input["refund_fee"] = "1"
  35. input["total_fee"] = "1"
  36. try:
  37. if wxRefund(input, config, results):
  38. echo "请求退款成功"
  39. echo results
  40. else:
  41. echo "请求退款失败"
  42. echo results
  43. except:
  44. echo wxErrorMessage()