stripe

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: GPL-3.0 Imports: 13 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) CancelPaymentIntent added in v1.14.15

func (c *Client) CancelPaymentIntent(tradeNo string) error

CancelPaymentIntent prevents a still-pending client secret from being paid after the local order has expired.

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) GetPaymentSheet added in v1.14.15

func (c *Client) GetPaymentSheet(order *Order, tradeNo string) (*PaymentSheet, error)

GetPaymentSheet returns the already-created PaymentIntent for a repeat checkout. It validates the immutable fields recorded in Stripe before exposing its client secret again.

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

func (*Client) VerifyPaymentIntent added in v1.14.15

func (c *Client) VerifyPaymentIntent(order *Order, tradeNo string) (bool, error)

VerifyPaymentIntent checks that the stored intent still belongs to the order before returning its payment state. It is used by expiry handling so a successful intent can be settled instead of being closed locally.

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
	Currency  string
}

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