Help us shape the future of Go! Take the 2026 Go Developer Survey

checkout

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkout

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

func NewCheckout

func NewCheckout(secretKey string, publicKey *string, environment string, webhookSecrets map[string]string) *Checkout

func (*Checkout) CheckWebhookKey

func (c *Checkout) CheckWebhookKey(keyCode, key string) bool

func (*Checkout) CreateInstrument added in v0.9.41

func (c *Checkout) CreateInstrument(request *instruments.Request) (*instruments.Response, error)

func (*Checkout) CreateToken added in v0.9.41

func (c *Checkout) CreateToken(request *tokens.Request) (string, error)

func (*Checkout) DeleteCustomerInstrument added in v0.9.20

func (c *Checkout) DeleteCustomerInstrument(instrumentID string) bool

func (*Checkout) GetCustomer added in v0.9.41

func (c *Checkout) GetCustomer(idOrEmail string) (bool, *CustomerResponse)

func (*Checkout) GetInstrument added in v0.9.50

func (c *Checkout) GetInstrument(sourceID string) (*instruments.Response, error)

func (*Checkout) GetPaymentDetail added in v0.9.55

func (c *Checkout) GetPaymentDetail(paymentID string) (*payments.PaymentResponse, error)

func (*Checkout) RequestPayment

func (c *Checkout) RequestPayment(request *payments.Request) *payments.Response

func (*Checkout) RequestRefunds added in v0.9.16

func (c *Checkout) RequestRefunds(amount uint64, paymentID, reference string, metadata map[string]string) *payments.RefundsResponse

func (*Checkout) SaveGetClient added in v0.9.41

func (c *Checkout) SaveGetClient(customerData *SaveCustomerRequest) (created bool, customer *CustomerResponse)

type CustomerPhone added in v0.9.41

type CustomerPhone struct {
	Number      string `json:"number"`
	CountryCode string `json:"country_code"`
}

type CustomerResponse added in v0.9.20

type CustomerResponse struct {
	ID       string        `json:"id"`
	Email    string        `json:"email"`
	Default  string        `json:"default"`
	Name     string        `json:"name"`
	Phone    CustomerPhone `json:"phone,omitempty"`
	Metadata struct {
		CouponCode string `json:"coupon_code"`
		PartnerID  int    `json:"partner_id"`
	} `json:"metadata"`
	Instruments []Instrument `json:"instruments"`
}

type ICheckout

type ICheckout interface {
	CheckWebhookKey(keyCode, key string) bool
	RequestPayment(request *payments.Request) *payments.Response
	RequestRefunds(amount uint64, paymentID, reference string, metadata map[string]string) *payments.RefundsResponse
	DeleteCustomerInstrument(instrumentID string) bool
	GetCustomer(idOrEmail string) (bool, *CustomerResponse)
	SaveGetClient(customerData *SaveCustomerRequest) (created bool, customer *CustomerResponse)
	CreateToken(request *tokens.Request) (string, error)
	CreateInstrument(request *instruments.Request) (*instruments.Response, error)
	GetPaymentDetail(paymentID string) (*payments.PaymentResponse, error)
	GetInstrument(sourceID string) (*instruments.Response, error)
}

type Instrument added in v0.9.20

type Instrument struct {
	ID            string `json:"id"`
	Type          string `json:"type"`
	Fingerprint   string `json:"fingerprint"`
	ExpiryMonth   int    `json:"expiry_month"`
	ExpiryYear    int    `json:"expiry_year"`
	Name          string `json:"name"`
	Scheme        string `json:"scheme"`
	Last4         string `json:"last4"`
	Bin           string `json:"bin"`
	CardType      string `json:"card_type"`
	CardCategory  string `json:"card_category"`
	Issuer        string `json:"issuer"`
	IssuerCountry string `json:"issuer_country"`
	ProductID     string `json:"product_id"`
	ProductType   string `json:"product_type"`
	AccountHolder struct {
		BillingAddress struct {
			AddressLine1 string `json:"address_line1"`
			AddressLine2 string `json:"address_line2"`
			City         string `json:"city"`
			State        string `json:"state"`
			Zip          string `json:"zip"`
			Country      string `json:"country"`
		} `json:"billing_address"`
		Phone struct {
			CountryCode string `json:"country_code"`
			Number      string `json:"number"`
		} `json:"phone"`
	} `json:"account_holder"`
}

type SaveCustomerRequest added in v0.9.41

type SaveCustomerRequest struct {
	Email    string            `json:"email"`
	Name     string            `json:"name"`
	Phone    *CustomerPhone    `json:"phone,omitempty"`
	Metadata map[string]string `json:"metadata"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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