Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCheckoutSession(amount int64, currency, successURL, cancelURL string) (*stripe.CheckoutSession, error)
- func ExpireSession(sessionID string) (*stripe.CheckoutSession, error)
- func GetRandomString(n int) string
- func GetSession(sessionID string) (*stripe.CheckoutSession, error)
- func NewClient(ctx context.Context, opts ...core.ClientOption) (*core.Client, error)
- func QueryOrder(orderID string) (*payments.Transaction, error)
- func WechatPay(amount int64, user, tradeNO, describe, callback string) (string, error)
- type Interface
- type StripePayment
- type WechatPayment
Constants ¶
View Source
const ( PaymentNotPaid = "notpaid" PaymentProcessing = "processing" PaymentFailed = "failed" PaymentExpired = "expired" PaymentSuccess = "success" PaymentUnknown = "unknown" )
View Source
const ( DefaultPort string = "443" DefaultDomain string = "cloud.sealos.io" )
View Source
const ( USD = "usd" CNY = "cny" )
const currentcy
View Source
const ( WechatPrivateKey = "WechatPrivateKey" MchID = "MchID" MchCertificateSerialNumber = "MchCertificateSerialNumber" MchAPIv3Key = "MchAPIv3Key" AppID = "AppID" NotifyCallbackURL = "NotifyCallbackURL" StatusSuccess = "SUCCESS" StatusProcessing = "PROCESSING" StatusNotPay = "NOTPAY" StatusFail = "FAILED" DefaultCallbackURL = "https://sealos.io/payment/wechat/callback" )
ENV keys
View Source
const StripeAPIKEY = "STRIPE_API_KEY"
Variables ¶
View Source
var Currency string
View Source
var DefaultURL = fmt.Sprintf("https://%s", env.GetEnvWithDefault("DOMAIN", DefaultDomain))
Functions ¶
func CreateCheckoutSession ¶
func ExpireSession ¶
ExpireSession
func GetRandomString ¶
func GetSession ¶
func QueryOrder ¶
func QueryOrder(orderID string) (*payments.Transaction, error)
Types ¶
type Interface ¶
type Interface interface { CreatePayment(amount int64, user, describe string) (string, string, error) GetPaymentDetails(sessionID string) (string, int64, error) ExpireSession(payment string) error }
func NewPayHandler ¶
type StripePayment ¶
type StripePayment struct { }
func (StripePayment) CreatePayment ¶
func (StripePayment) ExpireSession ¶
func (s StripePayment) ExpireSession(sessionID string) error
func (StripePayment) GetPaymentDetails ¶
func (s StripePayment) GetPaymentDetails(sessionID string) (string, int64, error)
type WechatPayment ¶
type WechatPayment struct { }
func (WechatPayment) CreatePayment ¶
func (WechatPayment) ExpireSession ¶
func (w WechatPayment) ExpireSession(_ string) error
func (WechatPayment) GetPaymentDetails ¶
func (w WechatPayment) GetPaymentDetails(sessionID string) (string, int64, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.