payments

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// StripeProvider is the string identifier for the Stripe payment provider.
	StripeProvider = "stripe"
	// PayPalProvider is the string identifier for the PayPal payment provider.
	PayPalProvider = "paypal"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Charger

type Charger func(amount uint64, currency string) (string, error)

Charger wraps the Charge method which creates new payments with the provider.

type PreauthorizationResult

type PreauthorizationResult struct {
	ID string `json:"id"`
}

PreauthorizationResult contains the data returned from a Preauthorization.

type Preauthorizer

type Preauthorizer func(amount uint64, currency string, description string) (*PreauthorizationResult, error)

Preauthorizer wraps the Preauthorize method which pre-authorizes a payment with the provider.

type Provider

type Provider interface {
	Name() string
	NewCharger(ctx context.Context, r *http.Request) (Charger, error)
	NewRefunder(ctx context.Context, r *http.Request) (Refunder, error)
	NewPreauthorizer(ctx context.Context, r *http.Request) (Preauthorizer, error)
}

Provider represents a payment provider that can optionally charge, refund, preauthorize payments.

type Refunder

type Refunder func(transactionID string, amount uint64, currency string) (string, error)

Refunder wraps the Refund method which refunds payments with the provider.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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