stripe

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Name = `stripe`

Variables

View Source
var SupportedCurrencies = []string{
	"USD", "EUR", "GBP", "AUD", "CAD", "CHF", "CNY",
	"DKK", "HKD", "JPY", "MXN", "NOK", "NZD", "SEK", "SGD",
}

Functions

func AmountToCent

func AmountToCent(amount float64, currency string) int64

AmountToCent 将金额转换为Stripe最小单位(分) 对于零小数位货币(JPY等),不乘以100

func CentToAmount

func CentToAmount(cent int64, currency string) float64

CentToAmount 将Stripe最小单位(分)转换为金额

func CurrencyToLower

func CurrencyToLower(currency string) string

CurrencyToLower 将货币代码转为小写(Stripe API使用小写)

func MapRefundStatus

func MapRefundStatus(status string) string

MapRefundStatus 映射Stripe Refund状态到项目标准状态 状态文档: https://stripe.com/docs/api/refunds/object#refund_object-status

func MappingStatus

func MappingStatus(status string) string

MappingStatus 映射Stripe PaymentIntent状态到项目标准状态 状态文档: https://stripe.com/docs/payments/intents#intent-statuses

func MoneyFeeToString

func MoneyFeeToString(moneyFee float64) string

MoneyFeeToString 金额转字符串

func New

func New() payment.Driver

Types

type Stripe

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

func (*Stripe) IsSupported

func (a *Stripe) IsSupported(s config.Support) bool

func (*Stripe) Pay

func (a *Stripe) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)

Pay 创建Stripe Checkout Session,返回跳转URL 文档: https://stripe.com/docs/api/checkout/sessions/create 使用 Checkout Session 模式,用户会被重定向到 Stripe 托管的付款页面完成支付

func (*Stripe) PayNotify

func (a *Stripe) PayNotify(ctx echo.Context) error

PayNotify 处理Stripe Webhook通知 文档: https://stripe.com/docs/webhooks

func (*Stripe) PayQuery

func (a *Stripe) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

PayQuery 查询支付意图状态 文档: https://stripe.com/docs/api/payment_intents/retrieve

func (*Stripe) Refund

func (a *Stripe) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)

Refund 发起退款 文档: https://stripe.com/docs/api/refunds/create

func (*Stripe) RefundNotify

func (a *Stripe) RefundNotify(ctx echo.Context) error

RefundNotify 退款通知处理(Stripe所有webhook共用同一endpoint,通过PayNotify统一分发)

func (*Stripe) RefundQuery

func (a *Stripe) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

RefundQuery 查询退款状态 文档: https://stripe.com/docs/api/refunds/retrieve

func (*Stripe) SetAccount

func (a *Stripe) SetAccount(account *config.Account) payment.Driver

func (*Stripe) SetNotifyCallback

func (a *Stripe) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver

func (*Stripe) VerifySign

func (a *Stripe) VerifySign(ctx echo.Context) error

VerifySign 验证签名

Jump to

Keyboard shortcuts

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