支付模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

api.go 6.7 KiB

1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package fb_pay
  2. const (
  3. ReqHeader = "application/json; charset=utf-8"
  4. TestUrl = "https://shq-api.51fubei.com/gateway/agent"
  5. PrdUrl = "https://shq-api.51fubei.com/gateway/agent"
  6. //Methods 接口名称
  7. Unification = "fbpay.order.create" //统一支付
  8. OrderQrcode = "fbpay.order.qrcode" //支付宝跳转支付
  9. AggregateCode = "fbpay.fixed.qrcode.create" //聚合码支付
  10. PaymentCode = "fbpay.order.pay" //付款码支付
  11. OrderQuery = "fbpay.order.query" //订单查询
  12. Refund = "fbpay.order.refund" //退款
  13. RefundQuery = "fbpay.order.refund.query" //退款查询
  14. WechatPaymentAuth = "openapi.agent.merchant.wechat.payment.auth" //微信网页授权
  15. UnionPaymentAuth = "openapi.agent.merchant.union.payment.auth" //银联云闪付授权
  16. )
  17. type BaseParameters struct {
  18. VendorSn string `json:"vendor_sn" label:"服务商开放平台id(服务商后台生成),服务商级接入该字段必填,与app_id二选一,根据接口级别进行判定"`
  19. AppId string `json:"app_id" label:"商户开放平台id(商户后台生成),商户级接入该字段必填,与vendor_sn二选一,根据接口级别进行判定"`
  20. Method string `json:"method" label:"接口名称"`
  21. Format string `json:"format" label:"接口格式,默认json"`
  22. SignMethod string `json:"sign_method" label:"签名算法,默认md5"`
  23. Nonce string `json:"nonce" label:"请求端随机生成数"`
  24. Version string `json:"version" label:"接口版本,默认1.0"`
  25. BizContent string `json:"biz_content" label:"请求参数的集合,除公共参数外所有请求参数都必须放在这个参数中"`
  26. }
  27. type RequestParameters struct {
  28. BaseParameters
  29. Sign string `json:"sign" label:"签名"`
  30. }
  31. type OrderCreateParameters struct {
  32. OrderCreateMustParameters
  33. PayWay string `json:"pay_way" label:"02:公众号,03:小程序"`
  34. StoreId int64 `json:"store_id" label:"商户门店号(如果只有一家有效门店,可不传)"`
  35. //CashierId int64 `json:"cashier_id" label:"收银员ID"`
  36. SubAppid string `json:"sub_appid" label:"公众号appid/小程序appid。当微信支付时,该字段必填(user_id需要保持一致,即为该公众号appid获取的)间联商户需提前配置对应公众号appid,对应配置接口"`
  37. Royalty int `json:"royalty" label:"1 分账自定义打标参数,1:参与分账(需开白名单),不传则默认不参与分账"`
  38. GoodsTag string `json:"goods_tag" label:"订单优惠标记,代金券或立减优惠功能的参数(使用单品券时必传)"`
  39. Detail string `json:"detail" label:"订单包含的商品信息,Json格式。当当微信支付或者支付宝支付时时可选填此字段。对于使用单品优惠的商户,该字段必须按照规范上传,详见“单品优惠参数说明”"`
  40. DeviceNo string `json:"device_no" label:"终端号"`
  41. Body string `json:"body" label:"商品描述"`
  42. Attach string `json:"attach" label:"附加数据,原样返回,该字段主要用于商户携带订单的自定义数据"`
  43. TimeoutExpress string `json:"timeout_express" label:"订单失效时间,逾期将关闭交易。格式为yyyyMMddHHmmss,失效时间需大于1分钟。银联暂不支持"`
  44. NotifyUrl string `json:"notify_url" label:"支付回调地址"`
  45. AlipayExtendParams string `json:"alipay_extend_params" label:"支付宝业务拓展参数--花呗分期"`
  46. PlatformStoreId string `json:"platform_store_id" label:"平台方门店号(即微信/支付宝的storeid)"`
  47. DisablePayChannels string `json:"disable_pay_channels" label:"禁止使用优惠券标识,promotion-支付宝优惠(包含实时优惠+商户优惠)"`
  48. Remark string `json:"remark" label:"备注"`
  49. PayScene string `json:"pay_scene"`
  50. }
  51. type OrderCreateMustParameters struct {
  52. MerchantOrderSn string `json:"merchant_order_sn" binding:"required" label:"外部系统订单号(确保唯一,前后不允许带空格)"`
  53. PayType string `json:"pay_type" binding:"required" label:"支付方式,,wxpay 微信,,alipay 支付宝,unionpay 银联云闪付"`
  54. TotalAmount float64 `json:"total_amount" binding:"订单总金额,单位为元,精确到0.01 ~ 10000000"`
  55. UserId string `json:"user_id" binding:"required" label:"用户标识,微信openid.支付宝userid,银联云闪付upUserId"`
  56. MerchantId int64 `json:"merchant_id" label:"付呗商户号,以服务商级接入时必传,以商户级接入时不传"`
  57. }
  58. type OrderCreateDetailParameters struct {
  59. CostPrice int64 `json:"cost_price" label:"1.商户侧一张小票订单可能被分多次支付,订单原价用于记录整张小票的交易金额。2.当订单原价与支付金额不相等,则不享受优惠。3.该字段主要用于防止同一张小票分多次支付,以享受多次优惠的情况,正常支付订单不必上传此参数。"`
  60. ReceiptId string `json:"receipt_id" label:"商家小票ID"`
  61. GoodsDetail string `json:"total_amount" binding:"单品信息,使用Json数组格式提交,见下文说明"`
  62. }
  63. type OrderCreateDetailGoodsDetailParameters struct {
  64. GoodsId string `json:"goods_id" binding:"required" label:"商品编码"`
  65. GoodsName string `json:"goods_name" binding:"required" label:"商品名称"`
  66. Quantity int `json:"quantity" binding:"required" label:"商品数量"`
  67. Price int64 `json:"price" binding:"required" label:"商品单价,单位为分"`
  68. }
  69. type OrderQrcodeParameters struct {
  70. OrderQrcodeMustParameters
  71. //CashierId int64 `json:"cashier_id" label:"收银员ID"`
  72. DeviceNo string `json:"device_no" label:"终端号"`
  73. Body string `json:"body" label:"商品描述"`
  74. Attach string `json:"attach" label:"附加数据,原样返回,该字段主要用于商户携带订单的自定义数据"`
  75. NotifyUrl string `json:"notify_url" label:"支付回调地址"`
  76. AlipayExtendParams string `json:"alipay_extend_params" label:"支付宝业务拓展参数--花呗分期"`
  77. }
  78. type OrderQrcodeMustParameters struct {
  79. MerchantOrderSn string `json:"merchant_order_sn" binding:"required" label:"外部系统订单号(确保唯一,前后不允许带空格)"`
  80. PayType string `json:"pay_type" binding:"required" label:"支付方式,alipay 支付宝 (目前只支持支付宝扫码)"`
  81. TotalAmount float64 `json:"total_amount" binding:"订单总金额,单位为元,精确到0.01 ~ 10000000"`
  82. StoreId int64 `json:"store_id" binding:"required" label:"商户门店号"`
  83. }