stripe

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = "2024-04-10"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
}

func NewClient

func NewClient(config Config) *Client

func (*Client) CreateCustomer

func (c *Client) CreateCustomer(user *User) (*stripe.Customer, error)

CreateCustomer Create a new Stripe customer

func (*Client) CreatePaymentSheet

func (c *Client) CreatePaymentSheet(order *Order, user *User) (*PaymentSheet, error)

func (*Client) CreateWebhookEndpoint

func (c *Client) CreateWebhookEndpoint(url string) (*stripe.WebhookEndpoint, error)

CreateWebhookEndpoint 创建 webhook endpoint

func (*Client) ParseNotify

func (c *Client) ParseNotify(payload []byte, signature string) (*NotifyResult, error)

ParseNotify

func (*Client) QueryOrderStatus

func (c *Client) QueryOrderStatus(orderNo string) (bool, error)

QueryOrderStatus Query the status of the order

func (*Client) RetrievePaymentMethod

func (c *Client) RetrievePaymentMethod(id string) (*stripe.PaymentMethod, error)

RetrievePaymentMethod 查询支付方式

func (*Client) SearchStripeCustomer

func (c *Client) SearchStripeCustomer(user *User) (*stripe.Customer, error)

SearchStripeCustomer Search for a Stripe customer by email or user ID

type Config

type Config struct {
	PublicKey     string
	SecretKey     string
	WebhookSecret string
}

type NotifyResult

type NotifyResult struct {
	EventType string
	OrderNo   string
	TradeNo   string
	Method    string
	UserId    int64
	Amount    int64
}

type Order

type Order struct {
	OrderNo   string
	Subscribe string
	Amount    int64
	Currency  string
	Payment   string
}

type PaymentSheet

type PaymentSheet struct {
	ClientSecret   string
	EphemeralKey   string
	Customer       string
	PublishableKey string
	TradeNo        string
}

type User

type User struct {
	UserId int64
	Email  string
}

Jump to

Keyboard shortcuts

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