paddle

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 13 Imported by: 0

README

Go Report Card Build Status Travis Coverage Godoc Releases LICENSE

Paddle

Go library to work with Paddle API

Installing / Getting started

go get github.com/lcd1232/paddle

Project versioning

paddle uses semantic versioning. API should not change between patch and minor releases. New minor versions may add additional features to the API.

Licensing

The code in this project is licensed under MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSignature = errors.New("paddle: invalid signature")
)

Functions

This section is empty.

Types

type Alert

type Alert string
const (
	AlertSubscriptionCreated          Alert = "subscription_created"
	AlertSubscriptionUpdated          Alert = "subscription_updated"
	AlertSubscriptionCancelled        Alert = "subscription_cancelled"
	AlertSubscriptionPaymentSucceeded Alert = "subscription_payment_succeeded"
	AlertSubscriptionPaymentFailed    Alert = "subscription_payment_failed"
	AlertSubscriptionPaymentRefunded  Alert = "subscription_payment_refunded"

	AlertPaymentSucceeded Alert = "payment_succeeded"
	AlertPaymentRefunded  Alert = "payment_refunded"
	AlertLockerProcessed  Alert = "locker_processed"

	AlertPaymentDisputeCreated      Alert = "payment_dispute_created"
	AlertPaymentDisputeClosed       Alert = "payment_dispute_closed"
	AlertHighRiskTransactionCreated Alert = "high_risk_transaction_created"
	AlertHighRiskTransactionUpdated Alert = "high_risk_transaction_updated"

	AlertTransferCreated Alert = "transfer_created"
	AlertTransferPaid    Alert = "transfer_paid"

	AlertNewAudienceMember    Alert = "new_audience_member"
	AlertUpdateAudienceMember Alert = "update_audience_member"

	AlertInvoicePaid    Alert = "invoice_paid"
	AlertInvoiceSent    Alert = "invoice_sent"
	AlertInvoiceOverdue Alert = "invoice_overdue"
)

func GetAlertName

func GetAlertName(form url.Values) (Alert, error)

type Client

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

func NewClient

func NewClient(publicKey string) (*Client, error)

func (*Client) ParseInvoiceOverdueWebhook added in v1.1.0

func (c *Client) ParseInvoiceOverdueWebhook(form url.Values) (InvoiceOverdue, error)

func (*Client) ParseInvoicePaidWebhook added in v1.1.0

func (c *Client) ParseInvoicePaidWebhook(form url.Values) (InvoicePaid, error)

func (*Client) ParseInvoiceSentWebhook added in v1.1.0

func (c *Client) ParseInvoiceSentWebhook(form url.Values) (InvoiceSent, error)

func (*Client) ParsePaymentSucceededWebhook added in v1.1.0

func (c *Client) ParsePaymentSucceededWebhook(form url.Values) (PaymentSucceeded, error)

func (*Client) ParseSubscriptionCancelledWebhook

func (c *Client) ParseSubscriptionCancelledWebhook(form url.Values) (SubscriptionCancelled, error)

func (*Client) ParseSubscriptionCreatedWebhook

func (c *Client) ParseSubscriptionCreatedWebhook(form url.Values) (SubscriptionCreated, error)

func (*Client) ParseSubscriptionPaymentFailedWebhook added in v1.1.0

func (c *Client) ParseSubscriptionPaymentFailedWebhook(form url.Values) (SubscriptionPaymentFailed, error)

func (*Client) ParseSubscriptionPaymentRefundedWebhook

func (c *Client) ParseSubscriptionPaymentRefundedWebhook(form url.Values) (SubscriptionPaymentRefunded, error)

func (*Client) ParseSubscriptionPaymentSucceededWebhook

func (c *Client) ParseSubscriptionPaymentSucceededWebhook(form url.Values) (SubscriptionPaymentSucceeded, error)

func (*Client) ParseSubscriptionUpdatedWebhook

func (c *Client) ParseSubscriptionUpdatedWebhook(form url.Values) (SubscriptionUpdated, error)

func (*Client) ParseTransferCreatedWebhook added in v1.1.0

func (c *Client) ParseTransferCreatedWebhook(form url.Values) (TransferCreated, error)

func (*Client) ParseTransferPaidWebhook added in v1.1.0

func (c *Client) ParseTransferPaidWebhook(form url.Values) (TransferPaid, error)

func (*Client) SetVerification

func (c *Client) SetVerification(b bool)

type InvoiceOverdue added in v1.1.0

type InvoiceOverdue struct {
	AlertName                    Alert
	AlertID                      string
	PaymentID                    string
	Amount                       string
	SaleGross                    string
	TermDays                     string
	Status                       Status
	PurchaseOrderNumber          string
	InvoicedAt                   time.Time
	Currency                     string
	ProductID                    string
	ProductName                  string
	ProductAdditionalInformation string
	CustomerID                   string
	CustomerName                 string
	Email                        string
	CustomerVatNumber            string
	CustomerCompanyNumber        string
	CustomerAddress              string
	CustomerCity                 string
	CustomerState                string
	CustomerZipcode              string
	Country                      string
	ContractID                   string
	ContractStartDate            time.Time
	ContractEndDate              time.Time
	Passthrough                  string
	DateCreated                  time.Time
	BalanceCurrency              string
	PaymentTax                   string
	PaymentMethod                PaymentMethod
	Fee                          string
	Earnings                     string
	EventTime                    time.Time
}

type InvoicePaid added in v1.1.0

type InvoicePaid struct {
	AlertName                    Alert
	AlertID                      string
	PaymentID                    string
	Amount                       string
	SaleGross                    string
	TermDays                     string
	Status                       Status
	PurchaseOrderNumber          string
	InvoicedAt                   time.Time
	Currency                     string
	ProductID                    string
	ProductName                  string
	ProductAdditionalInformation string
	CustomerID                   string
	CustomerName                 string
	Email                        string
	CustomerVatNumber            string
	CustomerCompanyNumber        string
	CustomerAddress              string
	CustomerCity                 string
	CustomerState                string
	CustomerZipcode              string
	Country                      string
	ContractID                   string
	ContractStartDate            time.Time
	ContractEndDate              time.Time
	Passthrough                  string
	DateCreated                  time.Time
	BalanceCurrency              string
	PaymentTax                   string
	PaymentMethod                PaymentMethod
	Fee                          string
	Earnings                     string
	BalanceEarnings              string
	BalanceFee                   string
	BalanceTax                   string
	BalanceGross                 string
	DateReconciled               time.Time
	EventTime                    time.Time
}

type InvoiceSent added in v1.1.0

type InvoiceSent struct {
	AlertName                    Alert
	AlertID                      string
	PaymentID                    string
	Amount                       string
	SaleGross                    string
	TermDays                     string
	Status                       Status
	PurchaseOrderNumber          string
	InvoicedAt                   time.Time
	Currency                     string
	ProductID                    string
	ProductName                  string
	ProductAdditionalInformation string
	CustomerID                   string
	CustomerName                 string
	Email                        string
	CustomerVatNumber            string
	CustomerCompanyNumber        string
	CustomerAddress              string
	CustomerCity                 string
	CustomerState                string
	CustomerZipcode              string
	Country                      string
	ContractID                   string
	ContractStartDate            time.Time
	ContractEndDate              time.Time
	Passthrough                  string
	DateCreated                  time.Time
	BalanceCurrency              string
	PaymentTax                   string
	PaymentMethod                PaymentMethod
	Fee                          string
	Earnings                     string
	EventTime                    time.Time
}

type PausedReason

type PausedReason string
const (
	PausedReasonDelinquent PausedReason = "delinquent"
	PausedReasonVoluntary  PausedReason = "voluntary"
)

type PaymentMethod

type PaymentMethod string

PaymentMethod defines possible payment method type.

const (
	PaymentMethodCard         PaymentMethod = "card"
	PaymentMethodPayPal       PaymentMethod = "paypal"
	PaymentMethodFree         PaymentMethod = "free"
	PaymentMethodApplePay     PaymentMethod = "apple-pay"
	PaymentMethodWireTransfer PaymentMethod = "wire-transfer"
)

type PaymentSucceeded added in v1.1.0

type PaymentSucceeded struct {
	AlertName        Alert
	AlertID          string
	BalanceCurrency  string
	BalanceEarnings  string
	BalanceFee       string
	BalanceGross     string
	BalanceTax       string
	CheckoutID       string
	Country          string
	Coupon           string
	Currency         string
	CustomerName     string
	Earnings         string
	Email            string
	EventTime        time.Time
	Fee              string
	MarketingConsent bool
	OrderID          string
	// IP defines user IP.
	// Deprecated, see https://developer.paddle.com/webhook-reference/one-off-purchase-alerts/payment-succeeded
	IP                string
	Passthrough       string
	PaymentMethod     PaymentMethod
	PaymentTax        string
	ProductID         string
	ProductName       string
	Quantity          int
	ReceiptURL        string
	SaleGross         string
	UsedPriceOverride bool
}

type RefundType

type RefundType string

RefundType defines possible reason for refund.

const (
	RefundTypeFull    RefundType = "full"
	RefundTypeVat     RefundType = "vat"
	RefundTypePartial RefundType = "partial"
)

type Status

type Status string
const (
	StatusActive   Status = "active"
	StatusTrialing Status = "trialing"
	StatusPastDue  Status = "past_due"
	StatusPaused   Status = "paused"
	StatusDeleted  Status = "deleted"
	StatusPaid     Status = "paid"
	StatusUnpaid   Status = "unpaid"
	StatusOverdue  Status = "overdue"
)

type SubscriptionCancelled

type SubscriptionCancelled struct {
	AlertName                 Alert
	AlertID                   string
	CancellationEffectiveDate time.Time
	CheckoutID                string
	Currency                  string
	Email                     string
	EventTime                 time.Time
	MarketingConsent          bool
	Passthrough               string
	Quantity                  int
	Status                    Status
	SubscriptionID            string
	SubscriptionPlanID        string
	UnitPrice                 string
	UserID                    string
}

type SubscriptionCreated

type SubscriptionCreated struct {
	AlertName          Alert
	AlertID            string
	CancelURL          string
	CheckoutID         string
	Currency           string
	Email              string
	EventTime          time.Time
	MarketingConsent   bool
	NextBillDate       time.Time
	Passthrough        string
	Quantity           int
	Source             string
	Status             Status
	SubscriptionID     string
	SubscriptionPlanID string
	UnitPrice          string
	UserID             string
	UpdateURL          string
}

type SubscriptionPaymentFailed added in v1.1.0

type SubscriptionPaymentFailed struct {
	AlertName             Alert
	AlertID               string
	Amount                string
	CancelURL             string
	CheckoutID            string
	Currency              string
	Email                 string
	EventTime             time.Time
	MarketingConsent      bool
	NextRetryDate         time.Time
	Passthrough           string
	Quantity              int
	Status                Status
	SubscriptionID        string
	SubscriptionPlanID    string
	UnitPrice             string
	UpdateURL             string
	SubscriptionPaymentID string
	Installments          int
	OrderID               string
	UserID                string
	AttemptNumber         int
}

type SubscriptionPaymentRefunded

type SubscriptionPaymentRefunded struct {
	AlertName               Alert
	AlertID                 string
	Amount                  string
	BalanceCurrency         string
	BalanceEarningsDecrease string
	BalanceFeeRefund        string
	BalanceGrossRefund      string
	BalanceTaxRefund        string
	CheckoutID              string
	Currency                string
	EarningsDecrease        string
	Email                   string
	EventTime               time.Time
	FeeRefund               string
	GrossRefund             string
	InitialPayment          bool
	Instalments             string
	MarketingConsent        bool
	OrderID                 string
	Passthrough             string
	Quantity                int
	RefundReason            string
	RefundType              RefundType
	Status                  Status
	SubscriptionID          string
	SubscriptionPaymentID   string
	SubscriptionPlanID      string
	TaxRefund               string
	UnitPrice               string
	UserID                  string
}

type SubscriptionPaymentSucceeded

type SubscriptionPaymentSucceeded struct {
	AlertName             Alert
	AlertID               string
	BalanceCurrency       string
	BalanceEarnings       string
	BalanceFee            string
	BalanceGross          string
	BalanceTax            string
	CheckoutID            string
	Country               string
	Coupon                string
	Currency              string
	CustomerName          string
	Earnings              string
	Email                 string
	EventTime             time.Time
	Fee                   string
	InitialPayment        bool
	Instalments           string
	MarketingConsent      bool
	NextBillDate          time.Time
	NextPaymentAmount     string
	OrderID               string
	Passthrough           string
	PaymentMethod         PaymentMethod
	PaymentTax            string
	PlanName              string
	Quantity              int
	ReceiptURL            string
	SaleGross             string
	Status                Status
	SubscriptionID        string
	SubscriptionPaymentID string
	SubscriptionPlanID    string
	UnitPrice             string
	UserID                string
}

type SubscriptionUpdated

type SubscriptionUpdated struct {
	AlertName Alert
	AlertID   string

	UpdateURL string
	CancelURL string

	CheckoutID       string
	Currency         string
	Email            string
	EventTime        time.Time
	MarketingConsent bool

	NewPrice     string
	NewQuantity  int
	NewUnitPrice string
	NextBillDate time.Time

	Passthrough        string
	Status             Status
	SubscriptionID     string
	SubscriptionPlanID string
	UserID             string

	OldNextBillDate       time.Time
	OldPrice              string
	OldQuantity           int
	OldStatus             Status
	OldSubscriptionPlanID string
	OldUnitPrice          string

	PausedAt     time.Time
	PausedFrom   time.Time
	PausedReason PausedReason
}

type TransferCreated added in v1.1.0

type TransferCreated struct {
	AlertName Alert
	AlertID   string
	Amount    string
	Currency  string
	EventTime time.Time
	PayoutID  string
	Status    Status
}

type TransferPaid added in v1.1.0

type TransferPaid struct {
	AlertName Alert
	AlertID   string
	Amount    string
	Currency  string
	EventTime time.Time
	PayoutID  string
	Status    Status
}

Jump to

Keyboard shortcuts

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