StripeFunctions

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallCallBack

func CallCallBack(event stripe.Event)

func Charge_succeeded

func Charge_succeeded(w http.ResponseWriter, r *http.Request, 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, callback func(event stripe.Event), extraMetadata map[string]string) (*stripe.Subscription, error)

func CreatePayment

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

func CreatePaymentPage

func CreatePaymentPage(userID int, amount float64, callback func(event stripe.Event), 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, callback func(event stripe.Event), 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, callback func(event stripe.Event), extraMetadata map[string]string) (*stripe.Subscription, error)

func CreateSubscriptionPage

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

func Customer_created

func Customer_created(w http.ResponseWriter, r *http.Request, event stripe.Event)

func Customer_subscription_created

func Customer_subscription_created(w http.ResponseWriter, r *http.Request, event stripe.Event)

func Custumer_subscription_deleted

func Custumer_subscription_deleted(w http.ResponseWriter, r *http.Request, event stripe.Event)

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 Invoice_created

func Invoice_created(w http.ResponseWriter, r *http.Request, event stripe.Event)

func Invoice_payment_succeeded

func Invoice_payment_succeeded(w http.ResponseWriter, r *http.Request, event stripe.Event)

func RegisterCallback

func RegisterCallback(id string, cb 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