StripeFunctions

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateFreeTrialCallback func(event stripe.Event)
View Source
var CreatePaymentCallback func(event stripe.Event)
View Source
var CreatePaymentPageCallback func(event stripe.Event)
View Source
var CreateScheduledSubscriptionCallback func(event stripe.Event)
View Source
var CreateSubscriptionCallback func(event stripe.Event)
View Source
var CreateSubscriptionPageCallback func(event stripe.Event)
View Source
var OtherEventCallback func(event stripe.Event)

Functions

func CallCallBack

func CallCallBack(event stripe.Event)

func CheckIfEmailIsBeingUsedInStripe

func CheckIfEmailIsBeingUsedInStripe(email string) bool

func CheckIfIDBeingUsedInStripe

func CheckIfIDBeingUsedInStripe(id string) bool

func CheckUserPaymentMethod

func CheckUserPaymentMethod(userID int) (bool, error)

func CreateFreeTrial

func CreateFreeTrial(userID int, start time.Time, duration time.Duration, PriceID string, extraMetadata map[string]string) (*stripe.Subscription, error)

func CreatePayment

func CreatePayment(userID int, amount float64, extraMetadata map[string]string) (*stripe.PaymentIntent, error)

func CreatePaymentPage

func CreatePaymentPage(userID int, amount float64, imageURL, description string,
	extraMetadata map[string]string, success_url string, cancel_url string) (*stripe.CheckoutSession, error)

func CreateScheduledSubscription

func CreateScheduledSubscription(userID int, start time.Time, trial_duration time.Duration, PriceID string, extraMetadata map[string]string) (*stripe.SubscriptionSchedule, error)

callback only calls when the start time is reached

func CreateSubscription

func CreateSubscription(userID int, trial_duration time.Duration, PriceID string, extraMetadata map[string]string) (*stripe.Subscription, error)

func CreateSubscriptionPage

func CreateSubscriptionPage(userID int, priceID string, extraMetadata map[string]string,
	success_url string, cancel_url string) (*stripe.CheckoutSession, error)

func GetCustomer

func GetCustomer(id string) (*stripe.Customer, error)

func GetEndDateUserStripe

func GetEndDateUserStripe(userId int) (database.Date, error)

func GetUserIdWithStripeID

func GetUserIdWithStripeID(stripeID string) (int, error)

func HandleCreatingCustomer

func HandleCreatingCustomer(usr database.User) (*stripe.Customer, error)

if custumer already exists in stripe it does not create a new one and uses the existing one

func SetCreateFreeTrialCallback added in v0.3.3

func SetCreateFreeTrialCallback(callback func(event stripe.Event))

func SetCreatePaymentCallback added in v0.3.3

func SetCreatePaymentCallback(callback func(event stripe.Event))

func SetCreatePaymentPageCallback added in v0.3.3

func SetCreatePaymentPageCallback(callback func(event stripe.Event))

func SetCreateScheduledSubscriptionCallback added in v0.3.3

func SetCreateScheduledSubscriptionCallback(callback func(event stripe.Event))

func SetCreateSubscriptionCallback added in v0.3.3

func SetCreateSubscriptionCallback(callback func(event stripe.Event))

func SetCreateSubscriptionPageCallback added in v0.3.3

func SetCreateSubscriptionPageCallback(callback func(event stripe.Event))

func SetOtherEventCallback added in v0.3.4

func SetOtherEventCallback(callback func(event stripe.Event))

Types

type Subscription

type Subscription struct {
	ID         string        `json:"id"`
	ScheduleID string        `json:"ScheduleID"`
	UserID     int           `json:"user_id"`
	StartDate  database.Date `json:"start_date"`
	EndDate    database.Date `json:"end_date"`
	Active     bool          `json:"active"`
	Trial      bool          `json:"trial"`
	Used       bool          `json:"used"`
	Schedule   bool          `json:"schedule"`
}

subscription funs

func GetAllSubscriptions

func GetAllSubscriptions(userID int) ([]Subscription, error)

func (Subscription) String

func (s Subscription) String() string

Jump to

Keyboard shortcuts

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