profit_sharing

package
v1.0.0-beta.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Package profit_sharing 分账

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultiProfitSharing

func MultiProfitSharing(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

请求多次分账

● 微信订单支付成功后,商户发起分账请求,将结算后的钱分到分账接收方。多次分账请求仅会按照传入的分账接收方进行分账,不会对剩余的金额进行任何操作。故操作成功后,在待分账金额不等于零时,订单依旧能够再次进行分账。

● 多次分账,可以将本商户作为分账接收方直接传入,实现释放资金给本商户的功能

● 对同一笔订单最多能发起20次多次分账请求

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_6&index=2

POST https://api.mch.weixin.qq.com/secapi/pay/multiprofitsharing

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.MultiProfitSharing(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharing

func ProfitSharing(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

请求单次分账

单次分账请求按照传入的分账接收方账号和资金进行分账,同时会将订单剩余的待分账金额解冻给本商户。故操作成功后,订单不能再进行分账,也不能进行分账完结。

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1

POST https://api.mch.weixin.qq.com/secapi/pay/profitsharing

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharing(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingAddReceiver

func ProfitSharingAddReceiver(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

添加分账接收方

商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_3&index=4

POST https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingAddReceiver(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingFinish

func ProfitSharingFinish(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

完结分账

1、不需要进行分账的订单,可直接调用本接口将订单的金额全部解冻给本商户 2、调用多次分账接口后,需要解冻剩余资金时,调用本接口将剩余的分账金额全部解冻给特约商户 3、已调用请求单次分账后,剩余待分账金额为零,不需要再调用此接口。

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_5&index=6

POST https://api.mch.weixin.qq.com/secapi/pay/profitsharingfinish

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingFinish(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingQuery

func ProfitSharingQuery(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

查询分账结果

发起分账请求后,可调用此接口查询分账结果;发起分账完结请求后,可调用此接口查询分账完结的执行结果。

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_2&index=3

POST https://api.mch.weixin.qq.com/pay/profitsharingquery

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingQuery(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingRemoveReceiver

func ProfitSharingRemoveReceiver(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

删除分账接收方

商户发起删除分账接收方请求,删除后不支持将结算后的钱分到该分账接收方

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_4&index=5

POST https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingRemoveReceiver(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingReturn

func ProfitSharingReturn(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

分账回退

● 对订单进行退款时,如果订单已经分账,可以先调用此接口将指定的金额从分账接收方(仅限商户类型的分账接收方)回退给本商户,然后再退款。

● 回退以原分账请求为依据,可以对分给分账接收方的金额进行多次回退,只要满足累计回退不超过该请求中分给接收方的金额。

● 此接口采用同步处理模式,即在接收到商户请求后,会实时返回处理结果

● 此功能需要接收方在商户平台-交易中心-分账-分账接收设置下,开启同意分账回退后,才能使用。

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7

POST https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingReturn(ctx, params)

	fmt.Println(resp, err)
}
Output:

func ProfitSharingReturnQuery

func ProfitSharingReturnQuery(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

回退结果查询

● 商户需要核实回退结果,可调用此接口查询回退结果。

● 如果分账回退接口返回状态为处理中,可调用此接口查询回退结果

See: https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_8&index=8

POST https://api.mch.weixin.qq.com/pay/profitsharingreturnquery

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/profit_sharing"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := profit_sharing.ProfitSharingReturnQuery(ctx, params)

	fmt.Println(resp, err)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL