paddle

package
v0.0.0-...-49ee507 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Float64

func Float64(v float64) *float64

Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func ParsePayload

func ParsePayload(payload map[string]string) (interface{}, error)

ParsePayload parses the alert payload. For recognized alert types, a value of the corresponding struct type will be returned. An error will be returned for unrecognized alert types.

Example usage:

func PaddleWebhookHandler(w http.ResponseWriter, r *http.Request) {
   payload, err := paddle.ValidatePayload(r, s.webhookSecretKey)
   if err != nil { ... }
   alert, err := paddle.ParsePayload(payload)
   if err != nil { ... }
   switch alert := alert.(type) {
   case *paddle.SubscriptionCreatedAlert:
       processSubscriptionCreatedAlert(alert)
   case *paddle.SubscriptionCanceledAlert:
       processSubscriptionCanceledAlert(alert)
   ...
   }
 }

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func ValidatePayload

func ValidatePayload(r *http.Request, publicKey []byte) (map[string]string, error)

ValidatePayload validates an incoming Paddle Webhook event request and returns the (map[string]string) payload. The Content-Type header of the payload needs to be "application/x-www-form-urlencoded". If the Content-Type is different then an error is returned. publicKey is the Paddle public key.

Example usage:

   func PaddleWebhookHandler(w http.ResponseWriter, r *http.Request) {
	payload, err := paddle.ValidatePayload(r, []byte(config.PaddleWebHookPublicKey))
	if err != nil { ... }
     // Process payload...
   }

Types

type AppliedCoupon

type AppliedCoupon struct {
	Code     *string  `json:"code,omitempty"`
	Discount *float64 `json:"discount,omitempty"`
}

type Checkout

type Checkout struct {
	CheckoutID *string `json:"checkout_id,omitempty"`
	ImageURL   *string `json:"image_url,omitempty"`
	Title      *string `json:"title,omitempty"`
}

type Client

type Client struct {

	// The vendor ID identifies your seller account. This can be found in Developer Tools > Authentication.
	VendorID *string

	// The vendor auth code is a private API key for authenticating API requests.
	// This key should never be used in client side code or shared publicly. This can be found in Developer Tools > Authentication.
	VendorAuthCode *string

	// Base URL for API requests. BaseURL should always be specified with a trailing slash.
	BaseURL *url.URL

	// Services used for talking to different parts of the Paddle API.
	Users         *UsersService
	Plans         *PlansService
	Modifiers     *ModifiersService
	Payments      *PaymentsService
	OneOffCharges *OneOffChargesService
	Webhooks      *WebhooksService
	OrderDetails  *OrderDetailsService
	UserHistory   *UserHistoryService
	Prices        *PricesService
	Coupons       *CouponsService
	Products      *ProductsService
	RefundPayment *RefundPaymentService
	PayLink       *PayLinkService
	// contains filtered or unexported fields
}

A Client manages communication with the Paddle API.

func NewCheckoutClient

func NewCheckoutClient(httpClient *http.Client) *Client

NewCheckoutClient returns a new Paddle API client for checkouts. If a nil httpClient is provided, http.DefaultClient will be used.

func NewClient

func NewClient(vendorID, vendorAuthCode string, httpClient *http.Client) *Client

NewClient returns a new Paddle API client. It requires a vendor_id and a vendor_auth_code arguments. If a nil httpClient is provided, http.DefaultClient will be used.

func NewSandboxCheckoutClient

func NewSandboxCheckoutClient(httpClient *http.Client) *Client

NewSandboxCheckoutClient returns a new Paddle API client for the sandbox checkout enivronement. If a nil httpClient is provided, http.DefaultClient will be used.

func NewSandboxClient

func NewSandboxClient(vendorID, vendorAuthCode string, httpClient *http.Client) *Client

NewSandboxClient returns a new Paddle API client for the sandbox environment. It requires a vendor_id and a vendor_auth_code arguments. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, options interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is url form encoded and included as the request body.

type Coupon

type Coupon struct {
	Coupon           *string  `json:"coupon,omitempty"`
	Description      *string  `json:"description,omitempty"`
	DiscountType     *string  `json:"discount_type,omitempty"`
	DiscountAmount   *float64 `json:"discount_amount,omitempty"`
	DiscountCurrency *string  `json:"discount_currency,omitempty"`
	AllowedUses      *int     `json:"allowed_uses,omitempty"`
	TimesUsed        *int     `json:"times_used,omitempty"`
	IsRecurring      *bool    `json:"is_recurring,omitempty"`
	Expires          *string  `json:"expires,omitempty"`
}

type CouponCodes

type CouponCodes struct {
	CouponCode []string `json:"coupon_code,omitempty"`
}

type CouponCreate

type CouponCreate struct {
	CouponCode     string  `url:"coupon_code,omitempty"`
	CouponPrefix   string  `url:"coupon_prefix,omitempty"`
	NumCoupons     int     `url:"num_coupons,omitempty"`
	Description    string  `url:"description,omitempty"`
	CouponType     string  `url:"coupon_type,omitempty"`
	ProductIds     string  `url:"product_ids,omitempty"`
	DiscountType   string  `url:"discount_type,omitempty"`
	DiscountAmount float64 `url:"discount_amount,omitempty"`
	Currency       string  `url:"currency,omitempty"`
	AllowedUses    int     `url:"allowed_uses,omitempty"`
	Expires        string  `url:"expires,omitempty"`
	Recurring      int     `url:"recurring,omitempty"`
	Group          string  `url:"group,omitempty"`
}

type CouponCreateOptions

type CouponCreateOptions struct {
	CouponCode   string
	CouponPrefix string
	NumCoupons   int
	Description  string
	ProductIds   string
	Currency     string
	AllowedUses  int
	Expires      string
	Recurring    int
	Group        string
}

type CouponCreateResponse

type CouponCreateResponse struct {
	Success  bool         `json:"success"`
	Response *CouponCodes `json:"response"`
}

type CouponDelete

type CouponDelete struct {
	CouponCode *string `url:"coupon_code,omitempty"`
	ProductID  *int    `url:"product_id,omitempty"`
}

type CouponDeleteOptions

type CouponDeleteOptions struct {
	ProductID int
}

type CouponDeleteResponse

type CouponDeleteResponse struct {
	Success bool `json:"success"`
}

type CouponUpdateOptions

type CouponUpdateOptions struct {
	CouponCode     string  `url:"coupon_code,omitempty"`
	Group          string  `url:"group,omitempty"`
	NewCouponCode  string  `url:"new_coupon_code,omitempty"`
	NewGroup       string  `url:"new_group,omitempty"`
	ProductIds     string  `url:"product_ids,omitempty"`
	Expires        string  `url:"expires,omitempty"`
	AllowedUses    int     `url:"allowed_uses,omitempty"`
	Currency       string  `url:"currency,omitempty"`
	DiscountAmount float64 `url:"discount_amount,omitempty"`
	Recurring      int     `url:"recurring,omitempty"`
}

type CouponUpdateResponse

type CouponUpdateResponse struct {
	Success  bool `json:"success"`
	Response *struct {
		Updated *int `json:"updated"`
	} `json:"response"`
}

type CouponsOptions

type CouponsOptions struct {
	ProductID int `url:"product_id,omitempty"`
}

CouponsOptions specifies the optional parameters to the CouponsService.List method.

type CouponsResponse

type CouponsResponse struct {
	Success  bool      `json:"success"`
	Response []*Coupon `json:"response"`
}

type CouponsService

type CouponsService service

CouponsService handles communication with the coupons related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/product-api/coupons/listcoupons

func (*CouponsService) Create

func (s *CouponsService) Create(ctx context.Context, couponType, discountType string, discountAmount float64, options *CouponCreateOptions) (*CouponCodes, *http.Response, error)

Create a new coupon for the given product or a checkout

Paddle API docs: https://developer.paddle.com/api-reference/product-api/coupons/createcoupon

func (*CouponsService) Delete

func (s *CouponsService) Delete(ctx context.Context, couponCode string, options *CouponDeleteOptions) (bool, *http.Response, error)

Delete a given coupon and prevent it from being further used

Paddle API docs: https://developer.paddle.com/api-reference/product-api/coupons/deletecoupon

func (*CouponsService) List

func (s *CouponsService) List(ctx context.Context, productID int) ([]*Coupon, *http.Response, error)

List all coupons valid for a specified one-time product or subscription plan

Paddle API docs: https://developer.paddle.com/api-reference/product-api/coupons/listcoupons

func (*CouponsService) Update

func (s *CouponsService) Update(ctx context.Context, options *CouponUpdateOptions) (*int, *http.Response, error)

Update an existing coupon in your account

Paddle API docs: https://developer.paddle.com/api-reference/product-api/coupons/updatecoupon

type Customer

type Customer struct {
	Email            *string `json:"email,omitempty"`
	MarketingConsent *bool   `json:"marketing_consent,omitempty"`
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type ErrorResponse

type ErrorResponse struct {
	Success    bool  `json:"success"`
	ErrorField Error `json:"error"`
	// contains filtered or unexported fields
}

An unsuccessful call to the Dashboard API will return a 200 response containing a field success set to false. Additionally an error object will be returned, containing a code referencing the error, and a message in a human-readable format.

type EventData

type EventData struct {
	ID        *int        `json:"id,omitempty"`
	AlertName *string     `json:"alert_name,omitempty"`
	Status    *string     `json:"status,omitempty"`
	CreatedAt *string     `json:"created_at,omitempty"`
	UpdatedAt *string     `json:"updated_at,omitempty"`
	Attempts  *int        `json:"attempts,omitempty"`
	Fields    *EventField `json:"fields,omitempty"`
}

type EventField

type EventField struct {
	OrderID          *int    `json:"order_id,omitempty"`
	Amount           *string `json:"amount,omitempty"`
	Currency         *string `json:"currency,omitempty"`
	Email            *string `json:"email,omitempty"`
	MarketingConsent *int    `json:"marketing_consent,omitempty"`
}

type FulfillmentWebhook

type FulfillmentWebhook struct {
	EventTime          *string `json:"event_time"`
	PCountry           *string `json:"p_country"`
	PCoupon            *string `json:"p_coupon"`
	PCouponSavings     *string `json:"p_coupon_savings"`
	PCurrency          *string `json:"p_currency"`
	PEarnings          *string `json:"p_earnings"`
	POrderID           *string `json:"p_order_id"`
	PPaddleFee         *string `json:"p_paddle_fee"`
	PPrice             *string `json:"p_price"`
	PProductID         *string `json:"p_product_id"`
	PQuantity          *string `json:"p_quantity"`
	PSaleGross         *string `json:"p_sale_gross"`
	PTaxAmount         *string `json:"p_tax_amount"`
	PUsedPriceOverride *string `json:"p_used_price_override"`
	Passthrough        *string `json:"passthrough"`
	Quantity           *string `json:"quantity"`
}

Sent when an order is processed for a product or plan with webhook fulfillment enabled Paddle reference: https://developer.paddle.com/webhook-reference/product-fulfillment/fulfillment-webhook

type HighRiskTransactionCreatedAlert

type HighRiskTransactionCreatedAlert struct {
	AlertName            *string `json:"alert_name"`
	AlertID              *string `json:"alert_id"`
	CaseID               *string `json:"case_id"`
	CheckoutID           *string `json:"checkout_id"`
	CreatedAt            *string `json:"created_at"`
	CustomerEmailAddress *string `json:"customer_email_address"`
	CustomerUserID       *string `json:"customer_user_id"`
	EventTime            *string `json:"event_time"`
	MarketingConsent     *string `json:"marketing_consent"`
	Passthrough          *string `json:"passthrough"`
	ProductID            *string `json:"product_id"`
	RiskScore            *string `json:"risk_score"`
	Status               *string `json:"status"`
}

Fired when a transaction is flagged as high risk. Paddle reference: https://developer.paddle.com/webhook-reference/risk-dispute-alerts/high-risk-transaction-created

type HighRiskTransactionUpdatedAlert

type HighRiskTransactionUpdatedAlert struct {
	AlertName            *string `json:"alert_name"`
	AlertID              *string `json:"alert_id"`
	CaseID               *string `json:"case_id"`
	CheckoutID           *string `json:"checkout_id"`
	CreatedAt            *string `json:"created_at"`
	CustomerEmailAddress *string `json:"customer_email_address"`
	CustomerUserID       *string `json:"customer_user_id"`
	EventTime            *string `json:"event_time"`
	MarketingConsent     *string `json:"marketing_consent"`
	OrderID              *string `json:"order_id"`
	Passthrough          *string `json:"passthrough"`
	ProductID            *string `json:"product_id"`
	RiskScore            *string `json:"risk_score"`
}

Fired when a flagged transaction is approved or rejected. Paddle reference: https://developer.paddle.com/webhook-reference/risk-dispute-alerts/high-risk-transaction-updated

type InvoiceOverdueAlert

type InvoiceOverdueAlert struct {
	AlertName                    *string `json:"alert_name"`
	AlertID                      *string `json:"alert_id"`
	PaymentID                    *string `json:"payment_id"`
	Amount                       *string `json:"amount"`
	SaleGross                    *string `json:"sale_gross"`
	TermDays                     *string `json:"term_days"`
	Status                       *string `json:"status"`
	PurchaseOrderNumber          *string `json:"purchase_order_number"`
	InvoicedAt                   *string `json:"invoiced_at"`
	Currency                     *string `json:"currency"`
	ProductID                    *string `json:"product_id"`
	ProductName                  *string `json:"product_name"`
	ProductAdditionalInformation *string `json:"product_additional_information"`
	CustomerID                   *string `json:"customer_id"`
	CustomerName                 *string `json:"customer_name"`
	Email                        *string `json:"email"`
	CustomerVatNumber            *string `json:"customer_vat_number"`
	CustomerCompanyNumber        *string `json:"customer_company_number"`
	CustomerAddress              *string `json:"customer_address"`
	CustomerCity                 *string `json:"customer_city"`
	CustomerState                *string `json:"customer_state"`
	CustomerZipcode              *string `json:"customer_zipcode"`
	Country                      *string `json:"country"`
	ContractID                   *string `json:"contract_id"`
	ContractStartDate            *string `json:"contract_start_date"`
	ContractEndDate              *string `json:"contract_end_date"`
	Passthrough                  *string `json:"passthrough"`
	DateCreated                  *string `json:"date_created"`
	BalanceCurrency              *string `json:"balance_currency"`
	PaymentTax                   *string `json:"payment_tax"`
	PaymentMethod                *string `json:"payment_method"`
	Fee                          *string `json:"fee"`
	Earnings                     *string `json:"earnings"`
	EventTime                    *string `json:"event_time"`
}

Fired when a manual invoice has exceeded the payment term and is now overdue. Paddle reference: https://developer.paddle.com/webhook-reference/manual-invoicing-alerts/invoice-overdue

type InvoicePaidAlert

type InvoicePaidAlert struct {
	AlertName                    *string `json:"alert_name"`
	AlertID                      *string `json:"alert_id"`
	PaymentID                    *string `json:"payment_id"`
	Amount                       *string `json:"amount"`
	SaleGross                    *string `json:"sale_gross"`
	TermDays                     *string `json:"term_days"`
	Status                       *string `json:"status"`
	PurchaseOrderNumber          *string `json:"purchase_order_number"`
	InvoicedAt                   *string `json:"invoiced_at"`
	Currency                     *string `json:"currency"`
	ProductID                    *string `json:"product_id"`
	ProductName                  *string `json:"product_name"`
	ProductAdditionalInformation *string `json:"product_additional_information"`
	CustomerID                   *string `json:"customer_id"`
	CustomerName                 *string `json:"customer_name"`
	Email                        *string `json:"email"`
	CustomerVatNumber            *string `json:"customer_vat_number"`
	CustomerCompanyNumber        *string `json:"customer_company_number"`
	CustomerAddress              *string `json:"customer_address"`
	CustomerCity                 *string `json:"customer_city"`
	CustomerState                *string `json:"customer_state"`
	CustomerZipcode              *string `json:"customer_zipcode"`
	Country                      *string `json:"country"`
	ContractID                   *string `json:"contract_id"`
	ContractStartDate            *string `json:"contract_start_date"`
	ContractEndDate              *string `json:"contract_end_date"`
	Passthrough                  *string `json:"passthrough"`
	DateCreated                  *string `json:"date_created"`
	BalanceCurrency              *string `json:"balance_currency"`
	PaymentTax                   *string `json:"payment_tax"`
	PaymentMethod                *string `json:"payment_method"`
	Fee                          *string `json:"fee"`
	Earnings                     *string `json:"earnings"`
	BalanceEarnings              *string `json:"balance_earnings"`
	BalanceFee                   *string `json:"balance_fee"`
	BalanceTax                   *string `json:"balance_tax"`
	BalanceGross                 *string `json:"balance_gross"`
	DateReconciled               *string `json:"date_reconciled"`
	EventTime                    *string `json:"event_time"`
}

Fired when a manual invoice has been successfully paid by a customer. Paddle reference: https://developer.paddle.com/webhook-reference/manual-invoicing-alerts/invoice-paid

type InvoiceSentAlert

type InvoiceSentAlert struct {
	AlertName                    *string `json:"alert_name"`
	AlertID                      *string `json:"alert_id"`
	PaymentID                    *string `json:"payment_id"`
	Amount                       *string `json:"amount"`
	SaleGross                    *string `json:"sale_gross"`
	TermDays                     *string `json:"term_days"`
	Status                       *string `json:"status"`
	PurchaseOrderNumber          *string `json:"purchase_order_number"`
	InvoicedAt                   *string `json:"invoiced_at"`
	Currency                     *string `json:"currency"`
	ProductID                    *string `json:"product_id"`
	ProductName                  *string `json:"product_name"`
	ProductAdditionalInformation *string `json:"product_additional_information"`
	CustomerID                   *string `json:"customer_id"`
	CustomerName                 *string `json:"customer_name"`
	Email                        *string `json:"email"`
	CustomerVatNumber            *string `json:"customer_vat_number"`
	CustomerCompanyNumber        *string `json:"customer_company_number"`
	CustomerAddress              *string `json:"customer_address"`
	CustomerCity                 *string `json:"customer_city"`
	CustomerState                *string `json:"customer_state"`
	CustomerZipcode              *string `json:"customer_zipcode"`
	Country                      *string `json:"country"`
	ContractID                   *string `json:"contract_id"`
	ContractStartDate            *string `json:"contract_start_date"`
	ContractEndDate              *string `json:"contract_end_date"`
	Passthrough                  *string `json:"passthrough"`
	DateCreated                  *string `json:"date_created"`
	BalanceCurrency              *string `json:"balance_currency"`
	PaymentTax                   *string `json:"payment_tax"`
	PaymentMethod                *string `json:"payment_method"`
	Fee                          *string `json:"fee"`
	Earnings                     *string `json:"earnings"`
	EventTime                    *string `json:"event_time"`
}

Fired when a manual invoice has been successfully sent to a customer. Paddle reference: https://developer.paddle.com/webhook-reference/manual-invoicing-alerts/invoice-sent

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve. (minimum: 1)
	Page int `url:"page,omitempty"`

	// Number of subscription records to return per page. (minimum: 1, maximum: 200)
	ResultsPerPage int `url:"results_per_page,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support pagination.

type Locker

type Locker struct {
	LockerID     *int    `json:"locker_id,omitempty"`
	ProductID    *int    `json:"product_id,omitempty"`
	ProductName  *string `json:"product_name,omitempty"`
	LicenseCode  *string `json:"license_code,omitempty"`
	Instructions *string `json:"instructions,omitempty"`
	Download     *string `json:"download,omitempty"`
}

type LockerProcessedAlert

type LockerProcessedAlert struct {
	AlertName        *string `json:"alert_name"`
	AlertID          *string `json:"alert_id"`
	CheckoutID       *string `json:"checkout_id"`
	CheckoutRecovery *string `json:"checkout_recovery"`
	Coupon           *string `json:"coupon"`
	Download         *string `json:"download"`
	Email            *string `json:"email"`
	EventTime        *string `json:"event_time"`
	Instructions     *string `json:"instructions"`
	Licence          *string `json:"licence"`
	MarketingConsent *string `json:"marketing_consent"`
	OrderID          *string `json:"order_id"`
	ProductID        *string `json:"product_id"`
	Quantity         *string `json:"quantity"`
	Source           *string `json:"source"`
}

Fired when an order is created after a successful payment event. Paddle reference: https://developer.paddle.com/webhook-reference/one-off-purchase-alerts/order-processing-completed

type Modifier

type Modifier struct {
	ModifierID     *int    `json:"modifier_id,omitempty"`
	SubscriptionID *int    `json:"subscription_id,omitempty"`
	Amount         *string `json:"amount,omitempty"`
	Currency       *string `json:"currency,omitempty"`
	IsRecurring    *bool   `json:"is_recurring,omitempty"`
	Description    *string `json:"description,omitempty"`
}

Modifier represents a Paddle modifier.

type ModifierCreate

type ModifierCreate struct {
	SubscriptionID      int     `url:"subscription_id,omitempty"`
	ModifierAmount      float64 `url:"modifier_amount,omitempty"`
	ModifierRecurring   bool    `url:"modifier_recurring,omitempty"`
	ModifierDescription string  `url:"modifier_description,omitempty"`
}

type ModifierCreateOptions

type ModifierCreateOptions struct {
	ModifierRecurring   bool
	ModifierDescription string
}

type ModifierCreateResponse

type ModifierCreateResponse struct {
	Success  bool      `json:"success"`
	Response *Modifier `json:"response"`
}

type ModifierDelete

type ModifierDelete struct {
	ModifierID int `url:"modifier_id,omitempty"`
}

type ModifierDeleteResponse

type ModifierDeleteResponse struct {
	Success bool `json:"success"`
}

type ModifiersOptions

type ModifiersOptions struct {
	// SubscriptionID filters modifiers based on the subscription id.
	SubscriptionID int `url:"subscription_id,omitempty"`
	// PlanID filters modifiers based on the plan id.
	PlanID int `url:"plan_id,omitempty"`
}

ModifiersOptions specifies the optional parameters to the ModifiersService.List method.

type ModifiersResponse

type ModifiersResponse struct {
	Success  bool        `json:"success"`
	Response []*Modifier `json:"response"`
}

type ModifiersService

type ModifiersService service

ModifiersService handles communication with the modifers related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/modifiers/

func (*ModifiersService) Create

func (s *ModifiersService) Create(ctx context.Context, subscriptionID int, modifierAmount float64, options *ModifierCreateOptions) (*Modifier, *http.Response, error)

Create a subscription modifier to dynamically change the subscription payment amount

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/modifiers/createmodifier

func (*ModifiersService) Delete

func (s *ModifiersService) Delete(ctx context.Context, modifierID int) (bool, *http.Response, error)

Delete an existing subscription modifier

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/modifiers/deletemodifier

func (*ModifiersService) List

List all subscription modifiers

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/modifiers/listmodifiers

type NewAudienceMemberAlert

type NewAudienceMemberAlert struct {
	AlertName        *string `json:"alert_name"`
	AlertID          *string `json:"alert_id"`
	CreatedAt        *string `json:"created_at"`
	Email            *string `json:"email"`
	EventTime        *string `json:"event_time"`
	MarketingConsent *string `json:"marketing_consent"`
	Products         *string `json:"products"`
	Source           *string `json:"source"`
	Subscribed       *string `json:"subscribed"`
	UserID           *string `json:"user_id"`
}

Fired when a customer opts in to receive marketing communication from you. Paddle reference: https://developer.paddle.com/webhook-reference/audience-alerts/new-audience-member

type OneOffCharge

type OneOffCharge struct {
	InvoiceID      *int     `json:"invoice_id,omitempty"`
	SubscriptionID *int     `json:"subscription_id,omitempty"`
	Amount         *float64 `json:"amount,omitempty"`
	Currency       *string  `json:"currency,omitempty"`
	PaymentDate    *string  `json:"payment_date,omitempty"`
	ReceiptUrl     *string  `json:"receipt_url,omitempty"`
	OrderID        *string  `json:"order_id,omitempty"`
	Status         *string  `json:"status,omitempty"`
}

OneOffCharge represents a Paddle one-off charge.

type OneOffChargeCreate

type OneOffChargeCreate struct {
	Amount     float64 `url:"amount,omitempty"`
	ChargeName string  `url:"charge_name,omitempty"`
}

type OneOffChargeResponse

type OneOffChargeResponse struct {
	Success  bool          `json:"success"`
	Response *OneOffCharge `json:"response"`
}

type OneOffChargesService

type OneOffChargesService service

OneOffChargesService handles communication with the one-off charges related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/one-off-charges/

func (*OneOffChargesService) Create

func (s *OneOffChargesService) Create(ctx context.Context, subscriptionID int, amount float64, chargeName string) (*OneOffCharge, *http.Response, error)

Make an immediate one-off charge on top of an existing user subscription

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/one-off-charges/createcharge

type OneTimeProduct

type OneTimeProduct struct {
	ID          *int                      `json:"id,omitempty"`
	Name        *string                   `json:"name,omitempty"`
	Description *string                   `json:"description,omitempty"`
	BasePrice   *float64                  `json:"base_price,omitempty"`
	SalePrice   *string                   `json:"sale_price,omitempty"`
	Screenshots *[]map[string]interface{} `json:"screenshots,omitempty"`
	Icon        *string                   `json:"icon,omitempty"`
	Currency    *string                   `json:"currency,omitempty"`
}

type OneTimeProducts

type OneTimeProducts struct {
	Total    *int              `json:"total,omitempty"`
	Count    *int              `json:"count,omitempty"`
	Products []*OneTimeProduct `json:"products,omitempty"`
}

Product represents a Paddle plan.

type Order

type Order struct {
	OrderID                    *int            `json:"order_id,omitempty"`
	Total                      *string         `json:"total,omitempty"`
	TotalTax                   *string         `json:"total_tax,omitempty"`
	Currency                   *string         `json:"currency,omitempty"`
	FormattedTotal             *string         `json:"formatted_total,omitempty"`
	FormattedTax               *string         `json:"formatted_tax,omitempty"`
	CouponCode                 *string         `json:"coupon_code,omitempty"`
	ReceiptUrl                 *string         `json:"receipt_url,omitempty"`
	CustomerSuccessRedirectURL *string         `json:"customer_success_redirect_url,omitempty"`
	HasLocker                  *bool           `json:"rhas_locker,omitempty"`
	IsSubscription             *bool           `json:"is_subscription,omitempty"`
	ProductID                  *int            `json:"product_id,omitempty"`
	SubscriptionID             *int            `json:"subscription_id,omitempty"`
	SubscriptionOrderID        *string         `json:"subscription_order_id,omitempty"`
	Quantity                   *int            `json:"quantity,omitempty"`
	Completed                  *OrderCompleted `json:"completed,omitempty"`
	Customer                   *Customer       `json:"customer,omitempty"`
}

type OrderCompleted

type OrderCompleted struct {
	Date         *string `json:"date,omitempty"`
	TimeZone     *string `json:"time_zone,omitempty"`
	TimeZoneType *int    `json:"time_zone_type,omitempty"`
}

type OrderDetails

type OrderDetails struct {
	State    *string   `json:"state,omitempty"`
	Checkout *Checkout `json:"checkout,omitempty"`
	Order    *Order    `json:"order,omitempty"`
	Lockers  []*Locker `json:"lockers,omitempty"`
}

OrderDetails represents a Paddle order details.

type OrderDetailsResponse

type OrderDetailsResponse struct {
	Success  bool          `json:"success"`
	Response *OrderDetails `json:"response"`
}

type OrderDetailsService

type OrderDetailsService service

OrderDetailsService handles communication with the order_details related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/order-details/

func (*OrderDetailsService) Get

func (s *OrderDetailsService) Get(ctx context.Context, checkoutID string) (*OrderDetails, *http.Response, error)

Get information about an order after a transaction completes

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/order-details/getorder

type PayLinkCreate

type PayLinkCreate struct {
	ProductID               int    `url:"product_id,omitempty"`
	Title                   string `url:"title,omitempty"`
	WebhookURL              string `url:"webhook_url,omitempty"`
	Prices                  string `url:"prices,omitempty"`
	RecurringPrices         string `url:"recurring_prices,omitempty"`
	TrialDays               int    `url:"trial_days,omitempty"`
	CustomMessage           string `url:"custom_message,omitempty"`
	CouponCode              string `url:"coupon_code,omitempty"`
	Discountable            int    `url:"discountable,omitempty"`
	ImageURL                string `url:"image_url,omitempty"`
	ReturnURL               string `url:"return_url,omitempty"`
	QuantityVariable        int    `url:"quantity_variable,omitempty"`
	Quantity                int    `url:"quantity,omitempty"`
	Expires                 string `url:"expires,omitempty"`
	Affiliates              string `url:"affiliates,omitempty"`
	RecurringAffiliateLimit int    `url:"recurring_affiliate_limit,omitempty"`
	MarketingConsent        int    `url:"marketing_consent,omitempty"`
	CustomerEmail           string `url:"customer_email,omitempty"`
	CustomerCountry         string `url:"customer_country,omitempty"`
	CustomerPostcode        string `url:"customer_postcode,omitempty"`
	Passthrough             string `url:"passthrough,omitempty"`
	VatNumber               string `url:"vat_number,omitempty"`
	VatCompanyName          string `url:"vat_company_name,omitempty"`
	VatStreet               string `url:"vat_street,omitempty"`
	VatCity                 string `url:"vat_city,omitempty"`
	VatState                string `url:"vat_state,omitempty"`
	VatCountry              string `url:"vat_country,omitempty"`
	VatPostcode             string `url:"vat_postcode,omitempty"`
}

type PayLinkCreateResponse

type PayLinkCreateResponse struct {
	Success  bool `json:"success"`
	Response *struct {
		URL *string `json:"url"`
	} `json:"response"`
}

type PayLinkService

type PayLinkService service

PayLinkService handles communication with the pay link related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/product-api/pay-links

func (*PayLinkService) Create

func (s *PayLinkService) Create(ctx context.Context, payLink *PayLinkCreate) (*string, *http.Response, error)

Generate a link with custom attributes set for a one-time or subscription checkout

Paddle API docs: https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink

type Payment

type Payment struct {
	ID             *int    `json:"id,omitempty"`
	SubscriptionID *int    `json:"subscription_id,omitempty"`
	Amount         *int    `json:"amount,omitempty"`
	Currency       *string `json:"currency,omitempty"`
	PayoutDate     *string `json:"payout_date,omitempty"`
	IsPaid         *int    `json:"is_paid,omitempty"`
	ReceiptUrl     *string `json:"receipt_url,omitempty"`
	IsOneOffCharge *int    `json:"is_one_off_charge,omitempty"`
}

Payment represents a Paddle payment.

type PaymentDisputeClosedAlert

type PaymentDisputeClosedAlert struct {
	AlertName        *string `json:"alert_name"`
	AlertID          *string `json:"alert_id"`
	Amount           *string `json:"amount"`
	BalanceAmount    *string `json:"balance_amount"`
	BalanceCurrency  *string `json:"balance_currency"`
	BalanceFee       *string `json:"balance_fee"`
	CheckoutID       *string `json:"checkout_id"`
	Currency         *string `json:"currency"`
	Email            *string `json:"email"`
	EventTime        *string `json:"event_time"`
	FeeUsd           *string `json:"fee_usd"`
	MarketingConsent *string `json:"marketing_consent"`
	OrderID          *string `json:"order_id"`
	Passthrough      *string `json:"passthrough"`
	Status           *string `json:"status"`
}

Fired when a dispute/chargeback is closed for a card transaction. This indicates that the dispute/chargeback was contested and won by Paddle. Paddle reference: https://developer.paddle.com/webhook-reference/risk-dispute-alerts/payment-dispute-closed

type PaymentDisputeCreatedAlert

type PaymentDisputeCreatedAlert struct {
	AlertName        *string `json:"alert_name"`
	AlertID          *string `json:"alert_id"`
	Amount           *string `json:"amount"`
	BalanceAmount    *string `json:"balance_amount"`
	BalanceCurrency  *string `json:"balance_currency"`
	BalanceFee       *string `json:"balance_fee"`
	CheckoutID       *string `json:"checkout_id"`
	Currency         *string `json:"currency"`
	Email            *string `json:"email"`
	EventTime        *string `json:"event_time"`
	FeeUsd           *string `json:"fee_usd"`
	MarketingConsent *string `json:"marketing_consent"`
	OrderID          *string `json:"order_id"`
	Passthrough      *string `json:"passthrough"`
	Status           *string `json:"status"`
}

Fired when a dispute/chargeback is raised for a card transaction. Paddle reference: https://developer.paddle.com/webhook-reference/risk-dispute-alerts/payment-dispute-created

type PaymentInformation

type PaymentInformation struct {
	PaymentMethod  *string `json:"payment_method,omitempty"`
	CardType       *string `json:"card_type,omitempty"`
	LastFourDigits *string `json:"last_four_digits,omitempty"`
	ExpiryDate     *string `json:"expiry_date,omitempty"`
}

type PaymentRefundedAlert

type PaymentRefundedAlert struct {
	AlertName               *string `json:"alert_name"`
	AlertID                 *string `json:"alert_id"`
	Amount                  *string `json:"amount"`
	BalanceCurrency         *string `json:"balance_currency"`
	BalanceEarningsDecrease *string `json:"balance_earnings_decrease"`
	BalanceFeeRefund        *string `json:"balance_fee_refund"`
	BalanceGrossRefund      *string `json:"balance_gross_refund"`
	BalanceTaxRefund        *string `json:"balance_tax_refund"`
	CheckoutID              *string `json:"checkout_id"`
	Currency                *string `json:"currency"`
	EarningsDecrease        *string `json:"earnings_decrease"`
	Email                   *string `json:"email"`
	EventTime               *string `json:"event_time"`
	FeeRefund               *string `json:"fee_refund"`
	GrossRefund             *string `json:"gross_refund"`
	MarketingConsent        *string `json:"marketing_consent"`
	OrderID                 *string `json:"order_id"`
	Passthrough             *string `json:"passthrough"`
	Quantity                *string `json:"quantity"`
	RefundReason            *string `json:"refund_reason"`
	RefundType              *string `json:"refund_type"`
	TaxRefund               *string `json:"tax_refund"`
}

Fired when a payment is refunded. Paddle reference: https://developer.paddle.com/webhook-reference/one-off-purchase-alerts/payment-refunded

type PaymentSucceededAlert

type PaymentSucceededAlert struct {
	AlertName         *string `json:"alert_name"`
	AlertID           *string `json:"alert_id"`
	BalanceCurrency   *string `json:"balance_currency"`
	BalanceEarnings   *string `json:"balance_earnings"`
	BalanceFee        *string `json:"balance_fee"`
	BalanceGross      *string `json:"balance_gross"`
	BalanceTax        *string `json:"balance_tax"`
	CheckoutID        *string `json:"checkout_id"`
	Country           *string `json:"country"`
	Coupon            *string `json:"coupon"`
	Currency          *string `json:"currency"`
	CustomerName      *string `json:"customer_name"`
	Earnings          *string `json:"earnings"`
	Email             *string `json:"email"`
	EventTime         *string `json:"event_time"`
	Fee               *string `json:"fee"`
	IP                *string `json:"ip"`
	MarketingConsent  *string `json:"marketing_consent"`
	OrderID           *string `json:"order_id"`
	Passthrough       *string `json:"passthrough"`
	PaymentMethod     *string `json:"payment_method"`
	PaymentTax        *string `json:"payment_tax"`
	ProductID         *string `json:"product_id"`
	ProductName       *string `json:"product_name"`
	Quantity          *string `json:"quantity"`
	ReceiptURL        *string `json:"receipt_url"`
	SaleGross         *string `json:"sale_gross"`
	UsedPriceOverride *string `json:"used_price_override"`
}

Fired when a payment is made into your Paddle account. Paddle reference: https://developer.paddle.com/webhook-reference/one-off-purchase-alerts/payment-succeeded

type PaymentUpdate

type PaymentUpdate struct {
	PaymentID int    `url:"payment_id,omitempty"`
	Date      string `url:"date,omitempty"`
}

type PaymentUpdateResponse

type PaymentUpdateResponse struct {
	Success bool `json:"success"`
}

type PaymentsOptions

type PaymentsOptions struct {
	// Payments for a specific subscription.
	SubscriptionID int `url:"subscription_id,omitempty"`
	// The product/plan ID (single or comma-separated values)
	Plan int `url:"plan,omitempty"`
	// Payment is paid (0 = No, 1 = Yes)
	IsPaid int `url:"is_paid,omitempty"`
	// Payments starting from (date in format YYYY-MM-DD)
	From string `url:"from,omitempty"`
	// Payments up to (date in format YYYY-MM-DD)
	To string `url:"to,omitempty"`
	// Non-recurring payments created from the
	IsOneOffCharge bool `url:"is_one_off_charge,omitempty"`
}

PaymentsOptions specifies the optional parameters to the Payments.List method.

type PaymentsResponse

type PaymentsResponse struct {
	Success  bool       `json:"success"`
	Response []*Payment `json:"response"`
}

type PaymentsService

type PaymentsService service

PaymentsService handles communication with the payments related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/payments/

func (*PaymentsService) List

func (s *PaymentsService) List(ctx context.Context, options *PaymentsOptions) ([]*Payment, *http.Response, error)

List all paid and upcoming (unpaid) payments

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/payments/listpayments

func (*PaymentsService) Update

func (s *PaymentsService) Update(ctx context.Context, paymentID int, date string) (bool, *http.Response, error)

Change the due date of the upcoming subscription payment

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/payments/updatepayment

type Plan

type Plan struct {
	ID             *int                   `json:"id,omitempty"`
	Name           *string                `json:"name,omitempty"`
	BillingType    *string                `json:"billing_type,omitempty"`
	BillingPeriod  *int                   `json:"billing_period,omitempty"`
	TrialDays      *int                   `json:"trial_days,omitempty"`
	InitialPrice   map[string]interface{} `json:"initial_price,omitempty"`
	RecurringPrice map[string]interface{} `json:"recurring_price,omitempty"`
}

Plan represents a Paddle plan.

type PlanCreate

type PlanCreate struct {
	PlanName          string `url:"plan_name,omitempty"`
	PlanLength        int    `url:"plan_length,omitempty"`
	PlanType          string `url:"plan_type,omitempty"`
	PlanTrialDays     int    `url:"plan_trial_days,omitempty"`
	MainCurrencyCode  string `url:"main_currency_code,omitempty"`
	RecurringPriceUsd string `url:"recurring_price_usd,omitempty"`
	RecurringPriceGbp string `url:"recurring_price_gbp,omitempty"`
	RecurringPriceEur string `url:"recurring_price_eur,omitempty"`
}

type PlanCreateOptions

type PlanCreateOptions struct {
	PlanTrialDays     int
	MainCurrencyCode  string
	RecurringPriceUsd string
	RecurringPriceGbp string
	RecurringPriceEur string
}

type PlanCreateResponse

type PlanCreateResponse struct {
	Success  bool     `json:"success"`
	Response *Product `json:"response"`
}

type PlansOptions

type PlansOptions struct {
	// PlanID filters Products/Plans based on their id.
	PlanID int `url:"plan,omitempty"`
}

PlansOptions specifies the optional parameters to the PLansService.List method.

type PlansResponse

type PlansResponse struct {
	Success  bool    `json:"success"`
	Response []*Plan `json:"response"`
}

type PlansService

type PlansService service

PlansService handles communication with the plans related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/plans

func (*PlansService) Create

func (s *PlansService) Create(ctx context.Context, planName, planType string, planLength int, options *PlanCreateOptions) (*Product, *http.Response, error)

Create a new subscription plan with the supplied parameters

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/plans/createplan

func (*PlansService) List

func (s *PlansService) List(ctx context.Context, options *PlansOptions) ([]*Plan, *http.Response, error)

List all of the available subscription plans in your account

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/plans/listplans

type Price

type Price struct {
	Gross *float64 `json:"gross,omitempty"`
	Net   *float64 `json:"net,omitempty"`
	Tax   *float64 `json:"tax,omitempty"`
}

type Prices

type Prices struct {
	CustomerCountry *string    `json:"customer_country,omitempty"`
	Products        []*Product `json:"products,omitempty"`
}

Prices represents a Paddle order details.

type PricesOptions

type PricesOptions struct {
	CustomerCountry string
	CustomerIP      string
	Coupons         string
}

type PricesResponse

type PricesResponse struct {
	Success  bool    `json:"success"`
	Response *Prices `json:"response"`
}

type PricesService

type PricesService service

PricesService handles communication with the prices related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/prices

func (*PricesService) Get

func (s *PricesService) Get(ctx context.Context, productIDs string, options *PricesOptions) (*Prices, *http.Response, error)

Retrieve prices for one or multiple products or plans

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/prices/getprices

type Product

type Product struct {
	ProductID                  *int           `json:"product_id,omitempty"`
	ProductTitle               *string        `json:"product_title,omitempty"`
	Currency                   *string        `json:"currency,omitempty"`
	VendorSetPricesIncludedTax *bool          `json:"vendor_set_prices_included_tax,omitempty"`
	Price                      *Price         `json:"price,omitempty"`
	ListPrice                  *Price         `json:"list_price,omitempty"`
	AppliedCoupon              *AppliedCoupon `json:"applied_coupon,omitempty"`
}

type ProductsResponse

type ProductsResponse struct {
	Success  bool             `json:"success"`
	Response *OneTimeProducts `json:"response"`
}

type ProductsService

type ProductsService service

ProductsService handles communication with the products related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/product-api/products

func (*ProductsService) List

List all published one-time products in your account

Paddle API docs: https://developer.paddle.com/api-reference/product-api/products/getproducts

type RefundPayment

type RefundPayment struct {
	OrderID string  `url:"order_id,omitempty"`
	Amount  float64 `url:"amount,omitempty"`
	Reason  string  `url:"reason,omitempty"`
}

type RefundPaymentOptions

type RefundPaymentOptions struct {
	Amount float64
	Reason string
}

RefundPaymentOptions specifies the optional parameters to the RefundPayment.Refund method.

type RefundPaymentResponse

type RefundPaymentResponse struct {
	Success  bool `json:"success"`
	Response *struct {
		RefundRequestID *int `json:"refund_request_id"`
	} `json:"response"`
}

type RefundPaymentService

type RefundPaymentService service

RefundPaymentService handles communication with the payments refund related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/product-api/payments/

func (*RefundPaymentService) Refund

func (s *RefundPaymentService) Refund(ctx context.Context, orderID string, options *RefundPaymentOptions) (*int, *http.Response, error)

Request a refund for a one-time or subscription payment, either in full or partial

Paddle API docs: https://developer.paddle.com/api-reference/product-api/payments/refundpayment

type SubscriptionCancelledAlert

type SubscriptionCancelledAlert struct {
	AlertName                 *string `json:"alert_name"`
	AlertID                   *string `json:"alert_id"`
	CancellationEffectiveDate *string `json:"cancellation_effective_date"`
	CheckoutID                *string `json:"checkout_id"`
	Currency                  *string `json:"currency"`
	Email                     *string `json:"email"`
	EventTime                 *string `json:"event_time"`
	LinkedSubscriptions       *string `json:"linked_subscriptions"`
	MarketingConsent          *string `json:"marketing_consent"`
	Passthrough               *string `json:"passthrough"`
	Quantity                  *string `json:"quantity"`
	Status                    *string `json:"status"`
	SubscriptionID            *string `json:"subscription_id"`
	SubscriptionPlanID        *string `json:"subscription_plan_id"`
	UnitPrice                 *string `json:"unit_price"`
	UserID                    *string `json:"user_id"`
}

The subscription canceled alert is triggered whenever a user cancel a subscription Paddle Reference: https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-cancelled

type SubscriptionCreatedAlert

type SubscriptionCreatedAlert struct {
	AlertName          *string `json:"alert_name"`
	AlertID            *string `json:"alert_id"`
	CancelURL          *string `json:"cancel_url"`
	CheckoutID         *string `json:"checkout_id"`
	Currency           *string `json:"currency"`
	Email              *string `json:"email"`
	EventTime          *string `json:"event_time"`
	MarketingConsent   *string `json:"marketing_consent"`
	NextBillDate       *string `json:"next_bill_date"`
	Passthrough        *string `json:"passthrough"`
	Quantity           *string `json:"quantity"`
	Source             *string `json:"source"`
	Status             *string `json:"status"`
	SubscriptionID     *string `json:"subscription_id"`
	SubscriptionPlanID *string `json:"subscription_plan_id"`
	UnitPrice          *string `json:"unit_price"`
	UserID             *string `json:"user_id"`
	UpdateURL          *string `json:"update_url"`
}

Fired when a new subscription is created, and a customer has successfully subscribed. Paddle Reference: https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-created

type SubscriptionPaymentFailedAlert

type SubscriptionPaymentFailedAlert struct {
	AlertName             *string `json:"alert_name"`
	AlertID               *string `json:"alert_id"`
	Amount                *string `json:"amount"`
	CancelURL             *string `json:"cancel_url"`
	CheckoutID            *string `json:"checkout_id"`
	Currency              *string `json:"currency"`
	Email                 *string `json:"email"`
	EventTime             *string `json:"event_time"`
	MarketingConsent      *string `json:"marketing_consent"`
	NextRetryDate         *string `json:"next_retry_date"`
	Passthrough           *string `json:"passthrough"`
	Quantity              *string `json:"quantity"`
	Status                *string `json:"status"`
	SubscriptionID        *string `json:"subscription_id"`
	SubscriptionPlanID    *string `json:"subscription_plan_id"`
	UnitPrice             *string `json:"unit_price"`
	UpdateURL             *string `json:"update_url"`
	SubscriptionPaymentID *string `json:"subscription_payment_id"`
	Instalments           *string `json:"instalments"`
	OrderID               *string `json:"order_id"`
	UserID                *string `json:"user_id"`
	AttemptNumber         *string `json:"attempt_number"`
}

Fired when a payment for an existing subscription fails. Paddle reference! https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-payment-failed

type SubscriptionPaymentRefundedAlert

type SubscriptionPaymentRefundedAlert struct {
	AlertName               *string `json:"alert_name"`
	AlertID                 *string `json:"alert_id"`
	Amount                  *string `json:"amount"`
	BalanceCurrency         *string `json:"balance_currency"`
	BalanceEarningsDecrease *string `json:"balance_earnings_decrease"`
	BalanceFeeRefund        *string `json:"balance_fee_refund"`
	BalanceGrossRefund      *string `json:"balance_gross_refund"`
	BalanceTaxRefund        *string `json:"balance_tax_refund"`
	CheckoutID              *string `json:"checkout_id"`
	Currency                *string `json:"currency"`
	EarningsDecrease        *string `json:"earnings_decrease"`
	Email                   *string `json:"email"`
	EventTime               *string `json:"event_time"`
	FeeRefund               *string `json:"fee_refund"`
	GrossRefund             *string `json:"gross_refund"`
	InitialPayment          *string `json:"initial_payment"`
	Instalments             *string `json:"instalments"`
	MarketingConsent        *string `json:"marketing_consent"`
	OrderID                 *string `json:"order_id"`
	Passthrough             *string `json:"passthrough"`
	Quantity                *string `json:"quantity"`
	RefundReason            *string `json:"refund_reason"`
	RefundType              *string `json:"refund_type"`
	Status                  *string `json:"status"`
	SubscriptionID          *string `json:"subscription_id"`
	SubscriptionPaymentID   *string `json:"subscription_payment_id"`
	SubscriptionPlanID      *string `json:"subscription_plan_id"`
	TaxRefund               *string `json:"tax_refund"`
	UnitPrice               *string `json:"unit_price"`
	UserID                  *string `json:"user_id"`
}

Fired when a refund for an existing subscription payment is issued. Paddle reference: https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-payment-refunded

type SubscriptionPaymentSucceededAlert

type SubscriptionPaymentSucceededAlert struct {
	AlertName             *string `json:"alert_name"`
	AlertID               *string `json:"alert_id"`
	BalanceCurrency       *string `json:"balance_currency"`
	BalanceEarnings       *string `json:"balance_earnings"`
	BalanceFee            *string `json:"balance_fee"`
	BalanceGross          *string `json:"balance_gross"`
	BalanceTax            *string `json:"balance_tax"`
	CheckoutID            *string `json:"checkout_id"`
	Country               *string `json:"country"`
	Coupon                *string `json:"coupon"`
	Currency              *string `json:"currency"`
	CustomerName          *string `json:"customer_name"`
	Earnings              *string `json:"earnings"`
	Email                 *string `json:"email"`
	EventTime             *string `json:"event_time"`
	Fee                   *string `json:"fee"`
	InitialPayment        *string `json:"initial_payment"`
	Instalments           *string `json:"instalments"`
	MarketingConsent      *string `json:"marketing_consent"`
	NextBillDate          *string `json:"next_bill_date"`
	NextPaymentAmount     *string `json:"next_payment_amount"`
	OrderID               *string `json:"order_id"`
	Passthrough           *string `json:"passthrough"`
	PaymentMethod         *string `json:"payment_method"`
	PaymentTax            *string `json:"payment_tax"`
	PlanName              *string `json:"plan_name"`
	Quantity              *string `json:"quantity"`
	ReceiptURL            *string `json:"receipt_url"`
	SaleGross             *string `json:"sale_gross"`
	Status                *string `json:"status"`
	SubscriptionID        *string `json:"subscription_id"`
	SubscriptionPaymentID *string `json:"subscription_payment_id"`
	SubscriptionPlanID    *string `json:"subscription_plan_id"`
	UnitPrice             *string `json:"unit_price"`
	UserID                *string `json:"user_id"`
}

Fired when a subscription payment is received successfully. Paddle reference: https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-payment-succeeded

type SubscriptionUpdatedAlert

type SubscriptionUpdatedAlert struct {
	AlertName             *string `json:"alert_name"`
	AlertID               *string `json:"alert_id"`
	CancelURL             *string `json:"cancel_url"`
	CheckoutID            *string `json:"checkout_id"`
	Email                 *string `json:"email"`
	EventTime             *string `json:"event_time"`
	LinkedSubscriptions   *string `json:"linked_subscriptions"`
	MarketingConsent      *string `json:"marketing_consent"`
	NewPrice              *string `json:"new_price"`
	NewQuantity           *string `json:"new_quantity"`
	NewUnitPrice          *string `json:"new_unit_price"`
	NextBillDate          *string `json:"next_bill_date"`
	OldPrice              *string `json:"old_price"`
	OldQuantity           *string `json:"old_quantity"`
	OldUnitPrice          *string `json:"old_unit_price"`
	Currency              *string `json:"currency"`
	Passthrough           *string `json:"passthrough"`
	Status                *string `json:"status"`
	SubscriptionID        *string `json:"subscription_id"`
	SubscriptionPlanID    *string `json:"subscription_plan_id"`
	UserID                *string `json:"user_id"`
	UpdateURL             *string `json:"update_url"`
	OldNextBillDate       *string `json:"old_next_bill_date"`
	OldStatus             *string `json:"old_status"`
	OldSubscriptionPlanID *string `json:"old_subscription_plan_id"`
	PausedAt              *string `json:"paused_at"`
	PausedFrom            *string `json:"paused_from"`
	PausedReason          *string `json:"paused_reason"`
}

Fired when the plan, price, quantity, status of an existing subscription changes, or if the payment date is rescheduled manually. Paddle reference: https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-updated

type TransferCreatedAlert

type TransferCreatedAlert struct {
	AlertName *string `json:"alert_name"`
	AlertID   *string `json:"alert_id"`
	Amount    *string `json:"amount"`
	Currency  *string `json:"currency"`
	EventTime *string `json:"event_time"`
	PayoutID  *string `json:"payout_id"`
	Status    *string `json:"status"`
}

Fired when a new transfer/payout is created for your account. Paddle reference: https://developer.paddle.com/webhook-reference/payout-alerts/transfer-created

type TransferPaidAlert

type TransferPaidAlert struct {
	AlertName *string `json:"alert_name"`
	AlertID   *string `json:"alert_id"`
	Amount    *string `json:"amount"`
	Currency  *string `json:"currency"`
	EventTime *string `json:"event_time"`
	PayoutID  *string `json:"payout_id"`
	Status    *string `json:"status"`
}

Fired when a new transfer/payout is marked as paid for your account. Paddle reference: https://developer.paddle.com/webhook-reference/payout-alerts/transfer-paid

type UpdateAudienceMemberAlert

type UpdateAudienceMemberAlert struct {
	AlertName           *string `json:"alert_name"`
	AlertID             *string `json:"alert_id"`
	EventTime           *string `json:"event_time"`
	NewCustomerEmail    *string `json:"new_customer_email"`
	NewMarketingConsent *string `json:"new_marketing_consent"`
	OldCustomerEmail    *string `json:"old_customer_email"`
	OldMarketingConsent *string `json:"old_marketing_consent"`
	Products            *string `json:"products"`
	Source              *string `json:"source"`
	UpdatedAt           *string `json:"updated_at"`
	UserID              *string `json:"user_id"`
}

Fired when the information of an audience member is updated. Paddle reference: https://developer.paddle.com/webhook-reference/audience-alerts/update-audience-member

type User

type User struct {
	SubscriptionID     *int                `json:"subscription_id,omitempty"`
	PlanID             *int                `json:"plan_id,omitempty"`
	UserID             *int                `json:"user_id,omitempty"`
	UserEmail          *string             `json:"user_email,omitempty"`
	MarketingConsent   *bool               `json:"marketing_consent,omitempty"`
	UpdateURL          *string             `json:"update_url,omitempty"`
	CancelURL          *string             `json:"cancel_url,omitempty"`
	State              *string             `json:"state,omitempty"`
	SignupDate         *string             `json:"signup_date,omitempty"`
	LastPayment        *UserPayment        `json:"last_payment,omitempty"`
	NextPayment        *UserPayment        `json:"next_payment,omitempty"`
	PaymentInformation *PaymentInformation `json:"payment_information,omitempty"`
	PausedAt           *string             `json:"paused_at,omitempty"`
	PausedFrom         *string             `json:"paused_from,omitempty"`
}

User represents a Paddle user.

type UserCancel

type UserCancel struct {
	SubscriptionID int `url:"subscription_id,omitempty"`
}

type UserCancelResponse

type UserCancelResponse struct {
	Success bool `json:"success"`
}

type UserHistory

type UserHistory struct {
	Message  *string `json:"message,omitempty"`
	Callback *string `json:"callback,omitempty"`
}

UserHistory represents a Paddle plan.

type UserHistoryOptions

type UserHistoryOptions struct {
	VendorID  *int64
	ProductID *int64
}

UserHistoryOptions specifies the optional parameters to the UserHistoryService.Get method.

type UserHistoryResponse

type UserHistoryResponse struct {
	Success  bool         `json:"success"`
	Response *UserHistory `json:"response"`
}

type UserHistoryService

type UserHistoryService service

UserHistoryService handles communication with the user history related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/user-history/

func (*UserHistoryService) Get

Send the customer an order history and license recovery email

Paddle API docs: https://developer.paddle.com/api-reference/checkout-api/user-history/getuserhistory

type UserPayment

type UserPayment struct {
	Amount   *float64 `json:"amount,omitempty"`
	Currency *string  `json:"currency,omitempty"`
	Date     *string  `json:"date,omitempty"`
}

type UserUpdate

type UserUpdate struct {
	SubscriptionID  int     `url:"subscription_id,omitempty"`
	Quantity        int     `url:"quantity,omitempty"`
	Currency        string  `url:"currency,omitempty"`
	RecurringPrice  float64 `url:"recurring_price,omitempty"`
	BillImmediately bool    `url:"bill_immediately,omitempty"`
	PlanID          int     `url:"plan_id,omitempty"`
	Prorate         bool    `url:"prorate,omitempty"`
	KeepModifiers   bool    `url:"keep_modifiers,omitempty"`
	Passthrough     string  `url:"passthrough,omitempty"`
	Pause           bool    `url:"pause,omitempty"`
}

type UserUpdateOptions

type UserUpdateOptions struct {
	Currency        string
	RecurringPrice  float64
	BillImmediately bool
	PlanID          int
	Prorate         bool
	KeepModifiers   bool
	Passthrough     string
	Pause           bool
}

type UserUpdateResponse

type UserUpdateResponse struct {
	Success  bool  `json:"success"`
	Response *User `json:"response"`
}

type UsersOptions

type UsersOptions struct {
	// SubscriptionID filters users based on their susbscription id.
	SubscriptionID string `url:"subscription_id,omitempty"`

	// PlanID filters users by the plan id.
	PlanID string `url:"plan_id,omitempty"`

	// State filters users based on the state. Possible values are: active,
	// past_due, trialing, paused, deleted. Returns all active, past_due,
	// trialing and paused subscription plans if not specified.
	State string `url:"state,omitempty"`

	ListOptions
}

UsersOptions specifies the optional parameters to the UsersService.List method.

type UsersResponse

type UsersResponse struct {
	Success  bool    `json:"success"`
	Response []*User `json:"response"`
}

type UsersService

type UsersService service

UsersService handles communication with the user related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/users

func (*UsersService) Cancel

func (s *UsersService) Cancel(ctx context.Context, subscriptionID int) (bool, *http.Response, error)

Cancel the specified user’s subscription

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/users/canceluser

func (*UsersService) List

func (s *UsersService) List(ctx context.Context, options *UsersOptions) ([]*User, *http.Response, error)

List all users subscribed to any of your subscription plans

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/users/listusers

func (*UsersService) Update

func (s *UsersService) Update(ctx context.Context, subscriptionID, quantity int, options *UserUpdateOptions) (*User, *http.Response, error)

Update the quantity, price, and/or plan of a user’s subscription

Paddle API docs: https://developer.paddle.com/api-reference/subscription-api/users/updateuser

type WebhookEvent

type WebhookEvent struct {
	CurrentPage   *int         `json:"current_page,omitempty"`
	TotalPages    *int         `json:"total_pages,omitempty"`
	AlertsPerPage *int         `json:"alerts_per_page,omitempty"`
	TotalAlerts   *int         `json:"total_alerts,omitempty"`
	QueryHead     *string      `json:"query_head,omitempty"`
	QueryTail     *string      `json:"query_tail,omitempty"`
	Data          []*EventData `json:"data,omitempty"`
}

WebhookEvent represents a Paddle plan.

type WebhookEventOptions

type WebhookEventOptions struct {
	// Number of webhook alerts to return per page. Returns 10 alerts by default.
	AlertsPerPage string `url:"alerts_per_page,omitempty"`
	// The date and time (UTC - Coordinated Universal Time) at which the webhook occurred before (end date). In the format: YYYY-MM-DD HH:MM:SS
	QueryHead string `url:"query_head,omitempty"`
	// The date and time (UTC - Coordinated Universal Time) at which the webhook occurred after (start date). In the format: YYYY-MM-DD HH:MM:SS
	QueryTail string `url:"query_tail,omitempty"`

	ListOptions
}

WebhookEventOptions specifies the optional parameters to the WebhooksService.Get method.

type WebhookEventResponse

type WebhookEventResponse struct {
	Success  bool          `json:"success"`
	Response *WebhookEvent `json:"response"`
}

type WebhooksService

type WebhooksService service

WebhooksService handles communication with the webhooks related methods of the Paddle API.

Paddle API docs: https://developer.paddle.com/api-reference/alert-api/webhooks/

func (*WebhooksService) Get

Retrieve past events and alerts that Paddle has sent to webhooks on your account

Paddle API docs: https://developer.paddle.com/api-reference/alert-api/webhooks/webhooks

Jump to

Keyboard shortcuts

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