apple

package
v0.5.28 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProductionBaseURL 苹果支付生产环境基础 URL
	ProductionBaseURL = "https://api.storekit.itunes.apple.com/inApps/v1"
	// SandboxBaseURL 沙箱环境基础 URL
	SandboxBaseURL = "https://api.storekit-sandbox.itunes.apple.com/inApps/v1"
)
View Source
const (
	// EnvironmentSandbox 沙箱环境
	EnvironmentSandbox = "Sandbox"
	// EnvironmentProduct 生产环境
	EnvironmentProduct = "Product"
)
View Source
const ApiRetryTimes = 5

ApiRetryTimes API 接口请求重试次数

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleStore

type AppleStore struct {
	Options *Options
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *AppleStore

func (*AppleStore) GetAllSubscriptionStatuses

func (apple *AppleStore) GetAllSubscriptionStatuses(txId string) (*gopay.AllSubscriptionStatusesRsp, error)

GetAllSubscriptionStatuses 获取所有订阅状态

func (*AppleStore) GetNotificationHistory

func (apple *AppleStore) GetNotificationHistory(paginationToken string, body *NotificationHistoryQuery) (*gopay.NotificationHistoryRsp, error)

GetNotificationHistory 获取通知历史

func (*AppleStore) GetRefundHistory

func (apple *AppleStore) GetRefundHistory(txId string, revision string) (*gopay.RefundHistoryRsp, error)

GetRefundHistory 获取退款历史

func (*AppleStore) GetTransaction

func (apple *AppleStore) GetTransaction(txId string) (*gopay.TransactionInfoRsp, error)

GetTransaction 获取交易信息

func (*AppleStore) GetTransactionHistory

func (apple *AppleStore) GetTransactionHistory(txId string, query *TransactionHistoryQuery) (*gopay.TransactionHistoryRsp, error)

GetTransactionHistory 获取交易历史

func (*AppleStore) LookUpOrderId

func (apple *AppleStore) LookUpOrderId(orderId string) (*gopay.LookUpOrderIdRsp, error)

func (*AppleStore) Provide

func (apple *AppleStore) Provide(ctx context.Context) any

func (*AppleStore) SendConsumptionInformation

func (apple *AppleStore) SendConsumptionInformation(txId string, params *ConsumptionParams) error

func (*AppleStore) VerifyReceipt

func (apple *AppleStore) VerifyReceipt(receipt string) (*gopay.VerifyResponse, error)

VerifyReceipt 验证收据

type ConsumptionParams

type ConsumptionParams struct {
	/**
	 * AccountTenure
	 * 必选值,客户账户的使用年限。
	 */
	AccountTenure *int64
	/**
	 * AppAccountToken
	 * 必选值,完成应用内购买交易的应用内用户帐户的 UUID。
	 */
	AppAccountToken *string
	/**
	 * ConsumptionStatus
	 * 必选值,该值表示客户消费应用内购买的程度。
	 */
	ConsumptionStatus *string
	/**
	 * CustomerConsented
	 * 必选值,表示客户是否同意提供消费数据。
	 */
	CustomerConsented *bool
	/**
	 * DeliveryStatus
	 * 必选值,该值指示应用是否成功交付了正常运行的应用内购买。
	 */
	DeliveryStatus *string
	/**
	 * LifetimeDollarsPurchased
	 * 必选值,该值表示客户在所有平台上在您的应用中进行的应用内购买的总金额(以美元为单位)。
	 */
	LifetimeDollarsPurchased *int64
	/**
	 * LifetimeDollarsRefunded
	 * 必选值,该值表示客户在您的应用中在所有平台上收到的退款总金额(以美元为单位)。
	 */
	LifetimeDollarsRefunded *int64
	/**
	 * Platform
	 * 必选值,该值指示客户进行应用内购买的平台。
	 */
	Platform *string
	/**
	 * PlayTime
	 * 必选值,表示客户使用该应用程序的时间量的值。
	 */
	PlayTime *int64
	/**
	 * RefundPreference
	 * 可选值,该值表示根据您的操作逻辑,Apple 是否应该批准退款的偏好。
	 */
	RefundPreference *bool
	/**
	 * SampleContentProvided
	 * 必选值,表示您是否在购买之前提供了内容的免费样本或试用版,或者有关其功能的信息。
	 */
	SampleContentProvided *bool
	/**
	 * UserStatus
	 * 必选值,客户账户的状态。
	 */
	UserStatus *string
}

ConsumptionParams 消费参数 https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information

type NotificationHistoryQuery

type NotificationHistoryQuery struct {
	/**
	 * StartDate
	 * 必选值,您要查询的开始日期。需要在当前日期之前的180天之内。
	 */
	StartDate *int64
	/**
	 * EndDate
	 * 必选值,您要查询的结束日期。
	 */
	EndDate *int64
	/**
	 * NotificationType
	 * 可选值,您要查询的通知类型。
	 */
	NotificationType *string
	/**
	 * NotificationSubtype
	 * 可选值,您要查询的通知子类型。
	 */
	NotificationSubtype *string
	/**
	 * OnlyFailures
	 * 可选值,您要查询的失败通知。
	 */
	OnlyFailures *bool
	/**
	 * TransactionId
	 * 可选值,您要查询的交易标识符。
	 */
	TransactionId *string
}

NotificationHistoryQuery 通知历史查询参数 https://developer.apple.com/documentation/appstoreserverapi/get_notification_history

type Option

type Option func(*Options)

func WithBid

func WithBid(bid string) Option

func WithIsProduct added in v0.5.20

func WithIsProduct(isProduct bool) Option

func WithIssuerId

func WithIssuerId(issuerId string) Option

func WithKeyId

func WithKeyId(keyId string) Option

func WithPrivateKey

func WithPrivateKey(privateKey string) Option

func WithPrivateKeyFile

func WithPrivateKeyFile(privateKeyFile string) Option

func WithShareSecret

func WithShareSecret(shareSecret string) Option

type Options

type Options struct {
	IsProduct      bool
	KeyId          string
	IssuerId       string
	Bid            string
	PrivateKey     string
	PrivateKeyFile string
	SharedSecret   string
}

type RefundHistoryQuery

type RefundHistoryQuery struct {
}

RefundHistoryQuery 退款历史查询参数 https://developer.apple.com/documentation/appstoreserverapi/get_refund_history

type TransactionHistoryQuery

type TransactionHistoryQuery struct {
	/**
	 * Revision
	 * 您在查询中使用的令牌,用于为客户请求下一组交易。使用上一次查询返回的值。
	 */
	Revision *string
	/**
	 * StartDate
	 * 可选值,您要查询的开始日期。
	 */
	StartDate *int64
	/**
	 * EndDate
	 * 可选值,您要查询的结束日期。
	 */
	EndDate *int64
	/**
	 * ProductId
	 * 可选值,您要查询的产品的标识符。
	 */
	ProductId *string
	/**
	 * ProductType
	 * 可选值,您要查询的产品类型。
	 */
	ProductType *string
	/**
	 * InAppOwnershipType
	 * 可选值,您要查询的购买类型。
	 */
	InAppOwnershipType *string
	/**
	 * Sort
	 * 可选值,您要查询的排序方式。默认值:ASCENDING。可选值:
	 * - ASCENDING:升序
	 * - DESCENDING:降序
	 */
	Sort *string
	/**
	 * Revoked
	 * 可选值,您要查询的已撤销交易。
	 */
	Revoked *bool
	/**
	 * SubscriptionGroupIdentifier
	 * 可选值,您要查询的订阅组标识符。
	 */
	SubscriptionGroupIdentifier *string
}

TransactionHistoryQuery 交易历史查询参数 https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history

Jump to

Keyboard shortcuts

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