pay

package
v1.2.39 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Deprecated: 使用新的 pkg.Pay()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatPublicKey added in v1.2.39

func FormatPublicKey(publicKey string) (pKey string)

func GetTime

func GetTime(timer string) time.Time

GetTime 根据提供的 timer 字符串解析时间,格式为 "YYYY-MM-DD HH:MM:SS ZZZ",若解析失败则返回当前时间

@Description: 根据指定格式解析时间字符串,如果解析失败或者格式不正确,则返回当前时间。
@param timer 时间字符串,格式为 "YYYY-MM-DD HH:MM:SS ZZZ",其中 ZZZ 为时区标识。
@return time.Time 解析得到的时间,若失败则返回当前时间。

Types

type AliPay

type AliPay struct {
	Client *alipay.Client
}

func Alipay

func Alipay() *AliPay

type ApplePay

type ApplePay struct {
	// contains filtered or unexported fields
}

ApplePay 苹果支付 这是一个用于处理苹果支付的结构体。

func (*ApplePay) Init

func (p *ApplePay) Init(data []byte)

Init 是ApplePay类型的初始化函数。

@Description: 对ApplePay对象进行初始化,将传入的数据存储到对象中。 @receiver p: ApplePay对象的指针,用于接收初始化操作。 @param data: 一个字节切片,包含需要初始化的数据。

func (*ApplePay) VerifyPay

func (p *ApplePay) VerifyPay(userId uint64, OrderId, package1, subscriptionID, purchaseToken string, isDebug bool, cb func(string) error) error

VerifyPay 验证苹果支付

@Description: 验证苹果支付的收据信息,以确认支付的有效性。 @receiver p *ApplePay: ApplePay对象,用于执行验证支付的操作。 @param userId uint64: 用户ID。 @param OrderId string: 订单ID。 @param package1 string: 付费产品的包装名称。 @param subscriptionID string: 订阅ID。 @param purchaseToken string: 购买令牌,用于苹果服务器的收据验证。 @param isDebug bool: 是否为调试模式,决定使用哪个验证URL。 @param cb func(string) error: 回调函数,用于处理验证成功后的产品ID。 @return error: 返回错误信息,如果验证过程中出现错误,则返回相应的错误信息。

func (*ApplePay) VerifyPayTest

func (p *ApplePay) VerifyPayTest(purchaseToken string) (interface{}, error)

VerifyPayTest 用于验证苹果支付的测试购买。

@Description:
@receiver p
@param purchaseToken
@return interface{}
@return error

func (*ApplePay) VerifyPayV1

func (p *ApplePay) VerifyPayV1(purchaseToken string, isDebug bool, cb func(string, string) error) error

VerifyPayV1 验证苹果支付的交易

@Description:
@receiver p
@param purchaseToken
@param isDebug
@param cb
@return error

type GooglePay

type GooglePay struct {
	// contains filtered or unexported fields
}

GooglePay 是一个处理Google支付的结构体。

func (*GooglePay) Acknowledge

func (p *GooglePay) Acknowledge(ctx context.Context, packageName, productID, token, developerPayload string) (err error)

Acknowledge 确认购买应用内商品。 Method: purchases.products.acknowledge y

func (*GooglePay) Consume

func (p *GooglePay) Consume(ctx context.Context, packageName, productID, token string) (err error)

Consume 消费购买应用内商品。

func (*GooglePay) GetRevokedPurchaseList

func (p *GooglePay) GetRevokedPurchaseList(package1 string) (res *androidpublisher.VoidedPurchasesListResponse, err error)

获取已撤销的购买列表

func (*GooglePay) GooglePayTokenV1

func (s *GooglePay) GooglePayTokenV1(token string) (err error)

谷歌支付支付凭证校验V1

func (*GooglePay) Init

func (p *GooglePay) Init(data []byte)

Init 初始化GooglePay客户端。 data: 初始化客户端所需的配置数据。

func (*GooglePay) VerifyPay

func (p *GooglePay) VerifyPay(userId int64, OrderId, package1, subscriptionID, purchaseToken string, cb func(string, string) error) error

VerifyPay 验证用户的支付。 userId: 用户ID。 OrderId: 订单ID。 package1: 应用包名。 subscriptionID: 订阅ID。 purchaseToken: 购买凭证。 cb: 验证结果的回调函数,如果验证成功,会调用此函数。 返回值: 执行错误。

func (*GooglePay) VerifyPayV1

func (p *GooglePay) VerifyPayV1(package1, subscriptionID, purchaseToken string, cb func(string, string) error) error

VerifyPayV1 是VerifyPay的另一个版本,用于验证订阅支付。 package1: 应用包名。 subscriptionID: 订阅ID。 purchaseToken: 购买凭证。 cb: 验证结果的回调函数。 返回值: 执行错误。

func (*GooglePay) VerifyPayV2

func (p *GooglePay) VerifyPayV2(types int32, package1, subscriptionID, purchaseToken string, cb func(string, string) error) error

VerifyPayV2 是VerifyPay的另一个版本,支持不同类型产品的验证。 types: 验证的产品类型。 package1: 应用包名。 subscriptionID: 订阅ID。 purchaseToken: 购买凭证。 cb: 验证结果的回调函数。 返回值: 执行错误。

func (*GooglePay) VerifySubSciption

func (p *GooglePay) VerifySubSciption(package1, subscriptionID, purchaseToken string) (string, error)

VerifySubSciption google 检查订阅是否有效

func (*GooglePay) VerifySubscriptionTest

func (p *GooglePay) VerifySubscriptionTest(package1, subscriptionID, purchaseToken string) (interface{}, error)

type WechatPay

type WechatPay struct {
	Client     *wechat.ClientV3
	PrivateKey string
}

GooglePay 是一个处理Google支付的结构体。

func Wechat deprecated

func Wechat() *WechatPay

Deprecated: pkg.Pay().Wechat()

func (*WechatPay) Authorization

func (c *WechatPay) Authorization(appid string, timestamp int64, nonceStr string, prepay_id string) (string, error)

v3 鉴权请求Header

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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