分账

添加接收方

  1. // 添加接收方。多次调用表示添加多个接收方
  2. paymentService.ProfitSharing.AddReceiver(
  3. ctx,
  4. "[type]",
  5. "[account]",
  6. "[name]",
  7. "[relation_type]",
  8. "[relation_type]",
  9. )

微信官方文档: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_8.shtml

删除接收方

  1. paymentService.ProfitSharing.DeleteReceiver(ctx,"[type]", "[account]")

微信官方文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_9.shtml

单次分账

  1. paymentService.ProfitSharing.Share(
  2. ctx,
  3. "[transaction_id]",
  4. "[out_order_no]",
  5. []*power.HashMap{
  6. {
  7. "type": "MERCHANT_ID",
  8. "account": "86693852",
  9. "name": "hu89ohu89ohu89o",
  10. "amount": 888,
  11. "description": "分给商户A",
  12. },
  13. {
  14. "type": "MERCHANT_ID",
  15. "account": "86693852",
  16. "name": "hu89ohu89ohu89o",
  17. "amount": 888,
  18. "description": "分给商户B",
  19. },
  20. }, false)

微信官方文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1

分账查询

  1. paymentService.ProfitSharing.Query(ctx,"[transaction_id]", "[out_trade_no]")

微信官方文档: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_2&index=3

分帐回退

  1. paymentService.ProfitSharing.Return(ctx, &request.RequestShareReturn{
  2. AppID: "[app_id]",
  3. MchID: "[mch_id]"
  4. OutOrderNo: "[transaction_id]",
  5. OutReturnNo: "[out_trade_no]"
  6. ReturnAccountType: "[return_account_type]"
  7. ReturnAccount: "[return_account]"
  8. ReturnAmount: "[return_amount]"
  9. Description: "[description]"
  10. })

微信官方文档: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=8