Documentation
¶
Index ¶
- Constants
- Variables
- func AmountToCent(amount float64, currency string) int64
- func CentToAmount(cent int64, currency string) float64
- func CurrencyToLower(currency string) string
- func MapRefundStatus(status string) string
- func MappingStatus(status string) string
- func MoneyFeeToString(moneyFee float64) string
- func New() payment.Driver
- type Stripe
- func (a *Stripe) IsSupported(s config.Support) bool
- func (a *Stripe) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)
- func (a *Stripe) PayNotify(ctx echo.Context) error
- func (a *Stripe) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Stripe) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)
- func (a *Stripe) RefundNotify(ctx echo.Context) error
- func (a *Stripe) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Stripe) SetAccount(account *config.Account) payment.Driver
- func (a *Stripe) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver
- func (a *Stripe) VerifySign(ctx echo.Context) error
Constants ¶
const Name = `stripe`
Variables ¶
var SupportedCurrencies = []string{
"USD", "EUR", "GBP", "AUD", "CAD", "CHF", "CNY",
"DKK", "HKD", "JPY", "MXN", "NOK", "NZD", "SEK", "SGD",
}
Functions ¶
func AmountToCent ¶
AmountToCent 将金额转换为Stripe最小单位(分) 对于零小数位货币(JPY等),不乘以100
func CentToAmount ¶
CentToAmount 将Stripe最小单位(分)转换为金额
func CurrencyToLower ¶
CurrencyToLower 将货币代码转为小写(Stripe API使用小写)
func MapRefundStatus ¶
MapRefundStatus 映射Stripe Refund状态到项目标准状态 状态文档: https://stripe.com/docs/api/refunds/object#refund_object-status
func MappingStatus ¶
MappingStatus 映射Stripe PaymentIntent状态到项目标准状态 状态文档: https://stripe.com/docs/payments/intents#intent-statuses
Types ¶
type Stripe ¶
type Stripe struct {
// contains filtered or unexported fields
}
func (*Stripe) Pay ¶
Pay 创建Stripe Checkout Session,返回跳转URL 文档: https://stripe.com/docs/api/checkout/sessions/create 使用 Checkout Session 模式,用户会被重定向到 Stripe 托管的付款页面完成支付
func (*Stripe) PayNotify ¶
PayNotify 处理Stripe Webhook通知 文档: https://stripe.com/docs/webhooks
func (*Stripe) PayQuery ¶
PayQuery 查询支付意图状态 文档: https://stripe.com/docs/api/payment_intents/retrieve
func (*Stripe) Refund ¶
Refund 发起退款 文档: https://stripe.com/docs/api/refunds/create
func (*Stripe) RefundNotify ¶
RefundNotify 退款通知处理(Stripe所有webhook共用同一endpoint,通过PayNotify统一分发)
func (*Stripe) RefundQuery ¶
RefundQuery 查询退款状态 文档: https://stripe.com/docs/api/refunds/retrieve
func (*Stripe) SetNotifyCallback ¶
func (a *Stripe) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver