invdendpoint

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 6 Imported by: 21

Documentation

Index

Constants

View Source
const (
	SourceEndpoint      = "/payment_sources"
	CardEndpoint        = "/cards"
	BankAccountEndpoint = "/bank_accounts"
)
View Source
const ChargeEndpoint = "/charges"
View Source
const ChasingCadenceEndpoint = "/chasing_cadences"
View Source
const CouponEndpoint = "/coupons"
View Source
const CreditBalanceAdjustmentsEndpoint = "/credit_balance_adjustments"
View Source
const CreditNoteEndpoint = "/credit_notes"
View Source
const CustomerEndpoint = "/customers"
View Source
const EstimateEndpoint = "/estimates"
View Source
const EventEndpoint = "/events"
View Source
const FileEndpoint = "/files"
View Source
const InvoiceEndpoint = "/invoices"
View Source
const ItemEndpoint = "/items"
View Source
const NoteEndpoint = "/notes"
View Source
const NotificationEndpoint = "/notifications"
View Source
const PaymentEndpoint = "/payments"
View Source
const PlanEndpoint = "/plans"
View Source
const RateEndpoint = "/tax_rates"
View Source
const RoleEndpoint = "/roles"
View Source
const SubscriptionEndpoint = "/subscriptions"
View Source
const TaskEndpoint = "/tasks"
View Source
const UsersEndpoint = "/members"
View Source
const WebhookEndpoint = "/webhook_attempts"

Variables

This section is empty.

Functions

func CleanMetaDataArray added in v1.0.1

func CleanMetaDataArray(b []byte) []byte

Types

type Balance added in v1.0.1

type Balance struct {
	Currency         string           `json:"currency,omitempty"`
	AvailableCredits float64          `json:"available_credits,omitempty"`
	PastDue          bool             `json:"past_due,omitempty"`
	Histories        BalanceHistories `json:"history,omitempty"`
	TotalOutstanding float64          `json:"total_outstanding,omitempty"`
	DueNow           float64          `json:"due_now,omitempty"`
}

type BalanceAdjustment added in v1.0.1

type BalanceAdjustment struct {
	Amount    float64 `json:"amount,omitempty"`
	CreatedAt int     `json:"created_at,omitempty"` //Timestamp when created
	Currency  string  `json:"currency,omitempty"`
	Customer  int     `json:"customer,omitempty"`
	Date      int     `json:"date,omitempty"`
	ID        int     `json:"id,omitempty"`
	Notes     string  `json:"notes,omitempty"`
	Object    string  `json:"object,omitempty"`
	UpdatedAt int     `json:"updated_at,omitempty"`
}

type BalanceHistories added in v1.0.1

type BalanceHistories []BalanceHistory

type BalanceHistory added in v1.0.1

type BalanceHistory struct {
	Currency  string  `json:"currency,omitempty"`
	Timestamp int64   `json:"timestamp,omitempty"`
	Balance   float64 `json:"balance,omitempty"`
}

type BankAccount added in v1.0.1

type BankAccount struct {
	Id              int64  `json:"id,omitempty"`     // The bank account’s unique ID
	Object          string `json:"object,omitempty"` // bank_account
	Gateway         string `json:"gateway,omitempty"`
	GatewayId       string `json:"gateway_id,omitempty"`
	GatewayCustomer string `json:"gateway_customer,omitempty"`
	Chargeable      bool   `json:"chargeable,omitempty"`
	BankName        string `json:"bank_name,omitempty"`      // Bank name
	Last4           string `json:"last4,omitempty"`          // Last 4 digits of bank account
	RoutingNumber   string `json:"routing_number,omitempty"` // Bank routing number
	Verified        bool   `json:"verified,omitempty"`       // Whether the bank account has been verified with instant verification or micro-deposits
	Currency        string `json:"currency,omitempty"`       // 3-letter ISO code
	Country         string `json:"country,omitempty"`        // 2-letter ISO code
	FailureReason   string `json:"failure_reason,omitempty"`
	ReceiptEmail    string `json:"receipt_email,omitempty"`
	CreatedAt       int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt       int64  `json:"updated_at,omitempty"`
}

type Card added in v1.0.1

type Card struct {
	Id              int64  `json:"id,omitempty"`     // The card’s unique ID
	Object          string `json:"object,omitempty"` // card
	Gateway         string `json:"gateway,omitempty"`
	GatewayId       string `json:"gateway_id,omitempty"`
	GatewayCustomer string `json:"gateway_customer,omitempty"`
	Chargeable      bool   `json:"chargeable,omitempty"`
	Brand           string `json:"brand,omitempty"`     // Card brand
	Last4           string `json:"last4,omitempty"`     // Last 4 digits of card
	ExpMonth        int    `json:"exp_month,omitempty"` // Expiry month
	ExpYear         int    `json:"exp_year,omitempty"`  // Expiry year
	Funding         string `json:"funding,omitempty"`   // Funding instrument, can be credit, debit, prepaid, or unknown
	FailureReason   string `json:"failure_reason,omitempty"`
	ReceiptEmail    string `json:"receipt_email,omitempty"`
	CreatedAt       int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt       int64  `json:"updated_at,omitempty"`
}

type Charge added in v1.0.1

type Charge struct {
	Id             int64          `json:"id,omitempty"`              // The payment’s unique ID
	Object         string         `json:"object,omitempty"`          // Object type, payment
	Customer       int64          `json:"customer,omitempty"`        // Customer ID, required if invoice ID is not supplied
	Status         string         `json:"status,omitempty"`          // Payment status, one of succeeded, pending, or failed, defaults to succeeded
	Gateway        string         `json:"gateway,omitempty"`         // Payment gateway that processed the payment, if any
	GatewayId      string         `json:"gateway_id,omitempty"`      // Payment ID from the payment gateway, or check # if method is check
	PaymentSource  *PaymentSource `json:"payment_source,omitempty"`  // Payment source used for payment, if any
	Currency       string         `json:"currency,omitempty"`        // 3-letter ISO code
	Amount         float64        `json:"amount,omitempty"`          // Payment amount
	FailureMessage string         `json:"failure_message,omitempty"` // Failure message from the payment gateway (only available when status = failed)
	AmountRefunded float64        `json:"amount_refunded,omitempty"`
	Refunded       bool           `json:"refunded,omitempty"`
	Refunds        []Refund       `json:"refunds,omitempty"`
	Disputed       bool           `json:"disputed,omitempty"`
	CreatedAt      int64          `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt      int64          `json:"updated_at,omitempty"` // Timestamp when updated
}

type ChargeRequest added in v1.0.1

type ChargeRequest struct {
	Customer          int64         `json:"customer,omitempty"`            // Customer ID, required if invoice ID is not supplied
	Method            string        `json:"method,omitempty"`              // Payment method ID, required
	Currency          string        `json:"currency,omitempty"`            // Optional, defaults to company currency
	Amount            float64       `json:"amount,omitempty"`              // Charge amount, required
	InvoicedToken     string        `json:"invoiced_token,omitempty"`      // Optional, generated by invoiced.js
	GatewayToken      string        `json:"gateway_token,omitempty"`       // Optional, generated by payment gateway
	PaymentSourceType string        `json:"payment_source_type,omitempty"` // One of card, bank_account
	PaymentSourceId   float64       `json:"payment_source_id,omitempty"`   // Optional, card or bank account ID
	VaultMethod       bool          `json:"vault_method,omitempty"`        // Optional; when true, vaults the payment source on the customer’s account
	MakeDefault       bool          `json:"make_default,omitempty"`        // Optional; when this and vault_method are true, saves payment as default on customer’s account
	ReceiptEmail      string        `json:"receipt_email,omitempty"`       // Optional; where the payment receipt is sent
	AppliedTo         []PaymentItem `json:"applied_to,omitempty"`          // Required, contains payment application, i.e. [{“type”: “invoice”, “invoice”: 1234, “amount”: 400.00}]
}

type ChasingCadence added in v1.0.1

type ChasingCadence struct {
	AssignmentConditions string        `json:"assignment_conditions,omitempty"`
	AssignmentMode       string        `json:"assignment_mode,omitempty"`
	CreatedAt            int64         `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt            int64         `json:"updated_at,omitempty"`
	Frequency            string        `json:"frequency,omitempty"`
	Id                   int64         `json:"id,omitempty"`
	LastRun              int64         `json:"last_run,omitempty"`
	MinBalance           float64       `json:"min_balance,omitempty"`
	Name                 string        `json:"name,omitempty"`
	NextRun              int64         `json:"nextrun,omitempty"`
	NumCustomers         int64         `json:"num_customers,omitempty"`
	Object               string        `json:"object,omitempty"`
	Paused               bool          `json:"paused,omitempty"`
	RunDate              int64         `json:"run_date,omitempty"`
	Steps                []ChasingStep `json:"steps,omitempty"`
	TimeOfDay            int           `json:"time_of_day,omitempty"`
}

type ChasingStep added in v1.0.1

type ChasingStep struct {
	Action          string `json:"action,omitempty"`
	AssignedUserId  int64  `json:"assigned_user_id,omitempty"`
	CreatedAt       int64  `json:"created_at,omitempty"` //Timestamp when created
	EmailTemplateId string `json:"email_template_id,omitempty"`
	Id              int64  `json:"id,omitempty"`
	Name            string `json:"name,omitempty"`
	Schedule        string `json:"schedule,omitempty"`
	SmsTemplateId   string `json:"sms_template_id"`
	UpdatedAt       int64  `json:"updated_at,omitempty"`
}

type Contact added in v1.0.1

type Contact struct {
	Id         int64  `json:"id,omitempty"`          // The customer’s unique ID
	Object     string `json:"object,omitempty"`      // Object type, contact
	Name       string `json:"name,omitempty"`        // Contact name
	Title      string `json:"title,omitempty"`       // Job title
	Email      string `json:"email,omitempty"`       // Email address
	Phone      string `json:"phone,omitempty"`       // Phone number
	Primary    bool   `json:"primary"`               // When true the contact will be copied on any account communications
	SmsEnabled bool   `json:"sms_enabled"`           // When true the contact can be contacted via text message
	Department string `json:"department,omitempty"`  // Department
	Address1   string `json:"address1,omitempty"`    // First address line
	Address2   string `json:"address2,omitempty"`    // Optional second address line
	City       string `json:"city,omitempty"`        // City
	State      string `json:"state,omitempty"`       // State or province
	PostalCode string `json:"postal_code,omitempty"` // Zip or postal code
	Country    string `json:"country,omitempty"`     // Two-letter ISO code
	CreatedAt  int64  `json:"created_at,omitempty"`  //Timestamp when created
	UpdatedAt  int64  `json:"updated_at,omitempty"`  // Timestamp when updated
}

type Contacts added in v1.0.1

type Contacts []Contact

type Coupon added in v1.0.1

type Coupon struct {
	Id             string                 `json:"id,omitempty"`         // The discount’s unique ID
	Object         string                 `json:"object,omitempty"`     // Object type, coupon
	Name           string                 `json:"name,omitempty"`       // Coupon name
	Currency       string                 `json:"currency,omitempty"`   // 3-letter ISO code
	Value          int64                  `json:"value,omitempty"`      // Amount
	IsPercent      bool                   `json:"is_percent,omitempty"` // When true the value is a %
	Exclusive      bool                   `json:"exclusive,omitempty"`  // exclusive
	Duration       int64                  `json:"durationo,omitempty"`
	ExpirationDate int64                  `json:"expiration_date,omitempty"` // Date coupon expires
	MaxRedemptions int64                  `json:"max_redemptions,omitempty"` // Max number of times coupon can be used
	CreatedAt      int64                  `json:"created_at,omitempty"`      //Timestamp when created
	UpdatedAt      int64                  `json:"updated_at,omitempty"`      // Timestamp when updated
	Metadata       map[string]interface{} `json:"metadata,omitempty"`        // A hash of key/value pairs that can store additional information about this object

}

type CreateNoteRequest added in v1.0.1

type CreateNoteRequest struct {
	CustomerID int64  `json:"customer_id,omitempty"` // Associated customer’s unique ID
	InvoiceID  int64  `json:"invoice_id,omitempty"`  // Associated invoice’s unique ID
	Notes      string `json:"notes,omitempty"`       // Contents of Notes
}

type CreditNote added in v1.0.1

type CreditNote struct {
	Id            int64                  `json:"id,omitempty"`       // The invoice’s unique ID
	Object        string                 `json:"object,omitempty"`   // Object type, estimate
	Customer      int64                  `json:"customer,omitempty"` // Customer ID
	Invoice       int64                  `json:"invoice,omitempty"`  // Customer ID
	Name          string                 `json:"name,omitempty"`     // Invoice name for internal use, defaults to “Invoice”
	Number        string                 `json:"number,omitempty"`   // The reference number assigned to the invoice for use in the dashboard
	Currency      string                 `json:"currency,omitempty"` // 3-letter ISO code
	Draft         bool                   `json:"draft,omitempty"`    // When false, the invoice is considered outstanding, or when true, the invoice is a draft
	Closed        bool                   `json:"closed,omitempty"`   // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Paid          bool                   `json:"paid,omitempty"`     // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Status        string                 `json:"status,omitempty"`   // Invoice state, one of draft, not_sent, sent, viewed, past_due, pending, paid
	Date          int64                  `json:"date,omitempty"`     // Invoice date
	PurchaseOrder string                 `json:"purchase_order,omitempty"`
	Items         []LineItem             `json:"items,omitempty"`           // Collection of Line Items
	Notes         string                 `json:"notes,omitempty"`           // Additional notes displayed on invoice
	Subtotal      float64                `json:"subtotal,omitempty"`        // Subtotal
	Discounts     []Discount             `json:"discounts,omitempty"`       // Collection of Discounts
	Taxes         []Tax                  `json:"taxes,omitempty"`           // Collection of Taxes
	Balance       float64                `json:"balance,omitempty"`         // Balance owed
	Total         float64                `json:"total,omitempty"`           // Total
	Url           string                 `json:"url,omitempty"`             // URL to download the invoice as a PDF
	PdfUrl        string                 `json:"pdf_url,omitempty"`         // URL to download the invoice as a PDF
	CreatedAt     int64                  `json:"created_at,omitempty"`      //Timestamp when created
	UpdatedAt     int64                  `json:"updated_at,omitempty"`      // Timestamp when updated
	Metadata      map[string]interface{} `json:"metadata,omitempty"`        // A hash of key/value pairs that can store additional information about this object.
	Attachments   []int64                `json:"attachments,omitempty"`     // A list of File IDs to attach to the estimate
	CalculateTax  bool                   `json:"calculate_taxes,omitempty"` // Disables tax calculation, default is true
}

func (*CreditNote) String added in v1.0.1

func (i *CreditNote) String() string

type CreditNotes added in v1.0.1

type CreditNotes []CreditNote

type Customer

type Customer struct {
	Id                     int64                  `json:"id,omitempty"` // The customer’s unique ID
	Object                 string                 `json:"object,omitempty"`
	Name                   string                 `json:"name,omitempty"`               // Customer name
	Number                 string                 `json:"number,omitempty"`             // A unique ID to help tie your customer to your external systems
	Email                  string                 `json:"email,omitempty"`              // Email address
	AutoPay                bool                   `json:"autopay,omitempty"`            // Autopay
	AutoPayDelays          int                    `json:"autopay_delay_days,omitempty"` // Number of days to delay AutoPay
	PaymentTerms           string                 `json:"payment_terms,omitempty"`      // Payment terms used for manual collection mode, i.e. “NET 30”
	PaymentSource          *PaymentSource         `json:"payment_source,omitempty"`     // Customer’s payment source, if attached
	AttentionTo            string                 `json:"attention_to,omitempty"`       // Used for ATTN: address line if company
	Address1               string                 `json:"address1,omitempty"`           // First address line
	Address2               string                 `json:"address2,omitempty"`           // Optional second address line
	City                   string                 `json:"city,omitempty"`               // City
	State                  string                 `json:"state,omitempty"`              // State or province
	PostalCode             string                 `json:"postal_code,omitempty"`        // Zip or postal code
	Country                string                 `json:"country,omitempty"`            // Two-letter ISO code
	Language               string                 `json:"language,omitempty"`           // Two-letter ISO code
	Currency               string                 `json:"currency,omitempty"`           // Three-letter ISO code
	Chase                  bool                   `json:"boolean,omitempty"`            // Chasing enabled? - defaults to true
	ChasingCadence         int64                  `json:"chasing_cadence,omitempty"`    // Cadence ID
	NextChaseStep          int64                  `json:"next_chase_step,omitempty"`
	Phone                  string                 `json:"phone,omitempty"`                    // Phone #
	CreditHold             bool                   `json:"credit_hold,omitempty"`              // When true, customer is on credit hold
	CreditLimit            float64                `json:"credit_limit,omitempty"`             // Customer credit limit
	Owner                  int64                  `json:"owner,omitempty"`                    // Customer credit limit
	Taxable                bool                   `json:"taxable,omitempty"`                  // Customer taxable?
	Taxes                  []TaxRate              `json:"taxes,omitempty"`                    // Collection of Tax Rate IDs
	TaxId                  string                 `json:"taxid,omitempty"`                    // Tax ID to be displayed on documents
	AvalaraEntityUseCode   string                 `json:"avalara_entity_use_code,omitempty"`  // Avalara-specific entity use code
	AvalaraExemptionNumber string                 `json:"avalara_exemption_number,omitempty"` // Tax-exempt number to pass to Avalara
	Type                   string                 `json:"type,omitempty"`                     // Organization type, company or person
	BillToParent           bool                   `json:"bill_to_parent,omitempty"`           // Parent customer ID
	ParentCustomer         int64                  `json:"parent_customer,omitempty"`          // Parent customer ID
	Notes                  string                 `json:"notes,omitempty"`                    // Private customer notes
	SignUpPage             int64                  `json:"sign_up_page,omitempty"`
	SignUpUrl              string                 `json:"sign_up_url,omitempty"`       // URL to download the latest account statement
	StatementPdfUrl        string                 `json:"statement_pdf_url,omitempty"` // URL to download the latest account statement
	CreatedAt              int64                  `json:"created_at,omitempty"`        //Timestamp when created
	UpdatedAt              int64                  `json:"updated_at,omitempty"`        // Timestamp when updated
	Metadata               map[string]interface{} `json:"metadata,omitempty"`          // A hash of key/value pairs that can store additional information about this object.
	DisabledPaymentMethods []string               `json:"disabled_payment_methods,omitempty"`
}

func (*Customer) String added in v1.0.1

func (c *Customer) String() string

type Customers

type Customers []Customer

type Discount

type Discount struct {
	Id      int64   `json:"id,omitempty"`      // The discount’s unique ID
	Amount  float64 `json:"amount,omitempty"`  // Discount amount
	Coupon  TaxRate `json:"coupon,omitempty"`  // Coupon the discount was computed from, if any
	Expires int64   `json:"expires,omitempty"` // Time until discount expires, if any
}

type EmailDetail added in v1.0.1

type EmailDetail struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

type EmailRequest added in v1.0.1

type EmailRequest struct {
	To       []EmailDetail `json:"to,omitempty"`
	Bcc      string        `json:"bcc,omitempty"`
	Subject  string        `json:"subject,omitempty"`
	Message  string        `json:"message,omitempty"`
	Template string        `json:"template,omitempty"`
	Type     string        `json:"type,omitempty"`
	Start    int64         `json:"start,omitempty"`
	End      int64         `json:"end,omitempty"`
	Items    string        `json:"items,omitempty"`
}

type Estimate added in v1.0.1

type Estimate struct {
	Id                     int64                  `json:"id,omitempty"`              // The invoice’s unique ID
	Object                 string                 `json:"object,omitempty"`          // Object type, estimate
	Customer               int64                  `json:"customer,omitempty"`        // Customer ID
	Invoice                int64                  `json:"invoice,omitempty"`         // Customer ID
	Name                   string                 `json:"name,omitempty"`            // Invoice name for internal use, defaults to “Invoice”
	Number                 string                 `json:"number,omitempty"`          // The reference number assigned to the invoice for use in the dashboard
	Currency               string                 `json:"currency,omitempty"`        // 3-letter ISO code
	Draft                  bool                   `json:"draft,omitempty"`           // When false, the invoice is considered outstanding, or when true, the invoice is a draft
	Closed                 bool                   `json:"closed,omitempty"`          // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Approved               string                 `json:"approved,omitempty"`        // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Status                 string                 `json:"status,omitempty"`          // Invoice state, one of draft, not_sent, sent, viewed, past_due, pending, paid
	Date                   int64                  `json:"date,omitempty"`            // Invoice date
	ExpirationDate         int64                  `json:"expiration_date,omitempty"` // Estimate expiration date
	PaymentTerms           string                 `json:"payment_terms,omitempty"`   // Payment terms for the invoice, i.e. “NET 30”
	PurchaseOrder          string                 `json:"purchase_order,omitempty"`
	Items                  []LineItem             `json:"items,omitempty"`                    // Collection of Line Items
	Notes                  string                 `json:"notes,omitempty"`                    // Additional notes displayed on invoice
	Subtotal               float64                `json:"subtotal,omitempty"`                 // Subtotal
	Discounts              []Discount             `json:"discounts,omitempty"`                // Collection of Discounts
	Taxes                  []Tax                  `json:"taxes,omitempty"`                    // Collection of Taxes
	ShipTo                 string                 `json:"ship_to,omitempty"`                  // Shipipng Detail object
	Total                  float64                `json:"total,omitempty"`                    // Total
	Deposit                float64                `json:"deposit,omitempty"`                  // Deposit
	DepositPaid            bool                   `json:"deposit_paid,omoitempty"`            // Deposit Paid
	Url                    string                 `json:"url,omitempty"`                      // URL to download the invoice as a PDF
	PdfUrl                 string                 `json:"pdf_url,omitempty"`                  // URL to download the invoice as a PDF
	CreatedAt              int64                  `json:"created_at,omitempty"`               //Timestamp when created
	UpdatedAt              int64                  `json:"updated_at,omitempty"`               // Timestamp when updated
	Metadata               map[string]interface{} `json:"metadata,omitempty"`                 // A hash of key/value pairs that can store additional information about this object.
	Attachments            []int64                `json:"attachments,omitempty"`              // A list of File IDs to attach to the estimate
	DisabledPaymentMethods []string               `json:"disabled_payment_methods,omitempty"` // List of payment methods to disable for this estimate, i.e. ["credit_card", "wire_transfer"].
	CalculateTax           bool                   `json:"calculate_taxes,omitempty"`          // Disables tax calculation, default is true
}

func (*Estimate) String added in v1.0.1

func (i *Estimate) String() string

type Estimates added in v1.0.1

type Estimates []Estimate

type Event added in v1.0.1

type Event struct {
	Id        int64           `json:"id,omitempty"` // The event’s unique ID
	Object    string          `json:"object,omitempty"`
	Type      string          `json:"type,omitempty"` // Event type
	Timestamp int64           `json:"timestamp,omitempty"`
	Data      json.RawMessage `json:"data,omitempty"` // Contains an object property with the object that was subject of the event and an optional previous property for object.updated events that is a hash of the old values that changed during the event
	User      *User           `json:"user,omitempty"`
}

func (*Event) ParseCustomerEvent added in v1.1.0

func (e *Event) ParseCustomerEvent() (*Customer, error)

func (*Event) ParseCustomerPreviousEvent added in v1.2.0

func (e *Event) ParseCustomerPreviousEvent() (*Customer, error)

func (*Event) ParseEventObject added in v1.0.1

func (e *Event) ParseEventObject() (*json.RawMessage, error)

func (*Event) ParseEventPreviousObject added in v1.0.1

func (e *Event) ParseEventPreviousObject() (*json.RawMessage, error)

func (*Event) ParseInvoiceEvent added in v1.0.1

func (e *Event) ParseInvoiceEvent() (*Invoice, error)

func (*Event) ParseInvoicePreviousEvent added in v1.0.1

func (e *Event) ParseInvoicePreviousEvent() (*Invoice, error)

func (*Event) ParsePaymentEvent added in v1.0.1

func (e *Event) ParsePaymentEvent() (*Payment, error)

func (*Event) ParseSubscriptionEvent added in v1.0.1

func (e *Event) ParseSubscriptionEvent() (*Subscription, error)

type EventObject added in v1.0.1

type EventObject struct {
	Object         *json.RawMessage `json:"object,omitempty"`
	PreviousObject *json.RawMessage `json:"previous,omitempty"`
}

type Events added in v1.0.1

type Events []Event

type Exclude added in v1.0.1

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

func NewExclude added in v1.0.1

func NewExclude() *Exclude

func (*Exclude) Set added in v1.0.1

func (e *Exclude) Set(key string)

func (*Exclude) String added in v1.0.1

func (e *Exclude) String() string

type Expand added in v1.0.1

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

func NewExpand added in v1.0.1

func NewExpand() *Expand

func (*Expand) Set added in v1.0.1

func (e *Expand) Set(key string)

func (*Expand) String added in v1.0.1

func (e *Expand) String() string

type File added in v1.0.1

type File struct {
	Id        int64  `json:"id,omitempty"`         // The file’s unique ID
	Object    string `json:"object,omitempty"`     // file
	Name      string `json:"name,omitempty"`       // Filename
	Size      int    `json:"size,omitempty"`       // File size in bytes
	Type      string `json:"type,omitempty"`       // MIME Type
	Url       string `json:"url,omitempty"`        // File URL
	CreatedAt int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt int64  `json:"updated_at,omitempty"` // Timestamp when updated
}

type Files added in v1.0.1

type Files []File

type Filter

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

func NewFilter

func NewFilter() *Filter

func NewMetadataFilter added in v1.0.1

func NewMetadataFilter() *Filter

func (*Filter) Get

func (f *Filter) Get(key string) string

func (*Filter) Set

func (f *Filter) Set(key string, value interface{}) error

Can only set Numeric Types and Strings

func (*Filter) String

func (f *Filter) String() string

type Invoice

type Invoice struct {
	Id                     int64                  `json:"id,omitempty"`     // The invoice’s unique ID
	Object                 string                 `json:"object,omitempty"` // Object type, invoice
	Customer               int64                  `json:"-"`
	CustomerFull           *Customer              `json:"-"`
	CustomerRaw            json.RawMessage        `json:"customer,omitempty"`
	Name                   string                 `json:"name,omitempty"`                 // Invoice name for internal use, defaults to “Invoice”
	Number                 string                 `json:"number,omitempty"`               // The reference number assigned to the invoice for use in the dashboard
	AutoPay                bool                   `json:"autopay,omitempty"`              // Invoice collection mode, auto or manual
	Currency               string                 `json:"currency,omitempty"`             // 3-letter ISO code
	Draft                  bool                   `json:"draft,omitempty"`                // When false, the invoice is considered outstanding, or when true, the invoice is a draft
	Closed                 bool                   `json:"closed,omitempty"`               // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Paid                   bool                   `json:"paid,omitempty"`                 // Indicates whether an invoice has been paid in full
	Status                 string                 `json:"status,omitempty"`               // Invoice state, one of draft, not_sent, sent, viewed, past_due, pending, paid
	AttemptCount           int64                  `json:"attempt_count,omitempty"`        //# of payment attempts
	NextPaymentAttempt     int64                  `json:"next_payment_attempt,omitempty"` // Next scheduled charge attempt, when in automatic collection
	Subscription           int64                  `json:"subscription,omitempty"`         // Subscription ID if invoice came from subscription
	Date                   int64                  `json:"date,omitempty"`                 // Invoice date
	DueDate                int64                  `json:"due_date,omitempty"`             // Date payment is due by
	PaymentTerms           string                 `json:"payment_terms,omitempty"`        // Payment terms for the invoice, i.e. “NET 30”
	PurchaseOrder          string                 `json:"purchase_order,omitempty"`
	Items                  []LineItem             `json:"items,omitempty"`           // Collection of Line Items
	Notes                  string                 `json:"notes,omitempty"`           // Additional notes displayed on invoice
	Subtotal               float64                `json:"subtotal,omitempty"`        // Subtotal
	Discounts              []Discount             `json:"discounts,omitempty"`       // Collection of Discounts
	Taxes                  []Tax                  `json:"taxes,omitempty"`           // Collection of Taxes
	Total                  float64                `json:"total,omitempty"`           // Total
	Balance                float64                `json:"balance,omitempty"`         // Balance owed
	Url                    string                 `json:"url,omitempty"`             // URL to view the invoice in the billing portal
	PaymentUrl             string                 `json:"payment_url,omitempty"`     // URL for the invoice payment page
	PdfUrl                 string                 `json:"pdf_url,omitempty"`         // URL to download the invoice as a PDF
	CreatedAt              int64                  `json:"created_at,omitempty"`      //Timestamp when created
	UpdatedAt              int64                  `json:"updated_at,omitempty"`      // Timestamp when updated
	Metadata               map[string]interface{} `json:"metadata,omitempty"`        // A hash of key/value pairs that can store additional information about this object.
	CalculateTaxes         bool                   `json:"calculate_taxes,omitempty"` // Flag to indicate whether taxes should be calculated on the invoice
	ShipTo                 *ShippingDetail        `json:"ship_to,omitempty"`
	Attachments            []int64                `json:"attachments,omitempty"`
	DisabledPaymentMethods []string               `json:"disabled_payment_methods,omitempty"`
	Sent                   bool                   `json:"sent,omitempty"`
	PaymentPlan            int64                  `json:"payment_plan,omitempty"`
}

func (*Invoice) MarshalJSON added in v1.0.1

func (i *Invoice) MarshalJSON() ([]byte, error)

func (*Invoice) String added in v1.0.1

func (i *Invoice) String() string

func (*Invoice) TotalDiscountAmount added in v1.0.1

func (i *Invoice) TotalDiscountAmount() float64

func (*Invoice) TotalTaxAmount added in v1.0.1

func (i *Invoice) TotalTaxAmount() float64

func (*Invoice) UnmarshalJSON added in v1.0.1

func (i *Invoice) UnmarshalJSON(data []byte) error

type Invoices

type Invoices []Invoice

type Item added in v1.0.1

type Item struct {
	Id                  string                 `json:"id,omitempty"`     // The item’s unique ID
	Object              string                 `json:"object,omitempty"` // Object name
	Name                string                 `json:"name,omitempty"`
	Currency            string                 `json:"currency,omitempty"`
	UnitCost            float64                `json:"unit_cost,omitempty"`
	Description         string                 `json:"description,omitempty"`      // Optional description
	Type                string                 `json:"service,omitempty"`          // Optional line item type. Used to group line items by type in reporting
	Taxable             bool                   `json:"taxable,omitempty"`          // Excludes amount from taxes when false
	Taxes               []Tax                  `json:"taxes,omitempty"`            // Collection of Tax Rate Objects
	AvalaraTaxCode      string                 `json:"avalara_tax_code,omitempty"` // Avalara-specific tax code
	GlAccount           string                 `json:"gl_account,omitempty"`       // General ledger account code
	AvalaraLocationCode string                 `json:"avalara_location_code,omitempty"`
	Discountable        bool                   `json:"discountable,omitempty"` // Excludes amount from discounts when false
	CreatedAt           int64                  `json:"created_at,omitempty"`   //Timestamp when created
	UpdatedAt           int64                  `json:"updated_at,omitempty"`   // Timestamp when updated
	Metadata            map[string]interface{} `json:"metadata,omitempty"`     // A hash of key/value pairs that can store additional information about this object.
}

type Items added in v1.0.1

type Items []Item

type LetterRequest added in v1.0.1

type LetterRequest struct {
	Type  string `json:"type,omitempty"`
	Start int64  `json:"start,omitempty"`
	End   int64  `json:"end,omitempty"`
	Items string `json:"items,omitempty"`
}

type LetterResponse added in v1.0.1

type LetterResponse struct {
	Id                   string `json:"id,omitempty"`
	To                   string `json:"to,omitempty"`
	State                string `json:"state,omitempty"`
	NumPages             int64  `json:"num_pages,omitempty"`
	ExpectedDeliveryDate int64  `json:"expected_delivery_date,omitempty"`
	CreatedAt            int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt            int64  `json:"updated_at,omitempty"`
}

type LineItem

type LineItem struct {
	Id           int64                  `json:"id,omitempty"`           // The line item’s unique ID
	Item         string                 `json:"catalog_item,omitempty"` // Optional Item ID. Fills the line item with the name and pricing of the Item.
	Type         string                 `json:"type,omitempty"`         // Optional line item type. Used to group line items by type in reporting
	Name         string                 `json:"name,omitempty"`         // Title
	Description  string                 `json:"description,omitempty"`  // Optional description
	Quantity     float64                `json:"quantity,omitempty"`     // Quantity
	UnitCost     float64                `json:"unit_cost,omitempty"`    // Unit cost or rate
	Amount       float64                `json:"amount,omitempty"`       // Computed from quantity x unit_cost
	Discountable bool                   `json:"discountable,omitempty"` // Excludes amount from invoice discounts when false
	Discounts    []Discount             `json:"discounts,omitempty"`    // Line item Discounts
	Taxable      bool                   `json:"taxable,omitempty"`      // Excludes amount from invoice taxes when false
	Taxes        []Tax                  `json:"taxes,omitempty"`        // Line item Taxes
	Plan         string                 `json:"plan,omitempty"`         // Plan ID, only present when type is plan
	PeriodStart  int64                  `json:"period_start,omitempty"`
	PeriodEnd    int64                  `json:"period_end,omitempty"`
	Prorated     bool                   `json:"prorated,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"` // A hash of key/value pairs that can store additional information about this object.
}

type LineItemPreview added in v1.0.1

type LineItemPreview struct {
	Item         string                 `json:"catalog_item,omitempty"` // Optional Item ID. Fills the line item with the name and pricing of the Item.
	Type         string                 `json:"type,omitempty"`         // Optional line item type. Used to group line items by type in reporting
	Name         string                 `json:"name,omitempty"`         // Title
	Description  string                 `json:"description,omitempty"`  // Optional description
	Quantity     float64                `json:"quantity,omitempty"`     // Quantity
	UnitCost     float64                `json:"unit_cost,omitempty"`    // Unit cost or rate
	Amount       float64                `json:"amount,omitempty"`       // Computed from quantity x unit_cost
	Discountable bool                   `json:"discountable,omitempty"` // Excludes amount from invoice discounts when false
	Discounts    []Discount             `json:"discounts,omitempty"`    // Line item Discounts
	Taxable      bool                   `json:"taxable,omitempty"`      // Excludes amount from invoice taxes when false
	Taxes        []Tax                  `json:"taxes,omitempty"`        // Line item Taxes
	Plan         string                 `json:"plan,omitempty"`         // Plan ID, only present when type is plan
	PeriodStart  int64                  `json:"period_start,omitempty"`
	PeriodEnd    int64                  `json:"period_end,omitempty"`
	Prorated     bool                   `json:"prorated,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"` // A hash of key/value pairs that can store additional information about this object.
}

type Note added in v1.0.1

type Note struct {
	Id        int64  `json:"id,omitempty"`         // The note’s unique ID
	Object    string `json:"object,omitempty"`     // Object type, note
	Notes     string `json:"notes,omitempty"`      // Contents of note
	Customer  int64  `json:"customer,omitempty"`   // Customer associated with note
	CreatedAt int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt int64  `json:"updated_at,omitempty"` // Timestamp when updated
	User      *User  `json:"user,omitempty"`       // Object describing user who created note
}

type Notes added in v1.0.1

type Notes []Note

type Notification added in v1.0.1

type Notification struct {
	Conditions string `json:"conditions,omitempty"`
	Enabled    bool   `json:"enabled,omitempty"`
	Event      string `json:"event,omitempty"`
	Id         int64  `json:"id,omitempty"`
	MatchMode  string `json:"match_mode,omitempty"`
	Medium     string `json:"medium,omitempty"`
	UserId     int64  `json:"user_id,omitempty"`
}

type NotificationRequest added in v1.0.1

type NotificationRequest struct {
	Enabled bool   `json:"enabled,omitempty"`
	Event   string `json:"event,omitempty"`
	Medium  string `json:"medium,omitempty"`
	Role    string `json:"role,omitempty"`
	UserId  int64  `json:"user_id,omitempty"`
}

type NotificationResponse added in v1.0.1

type NotificationResponse struct {
	Conditions string `json:"conditions,omitempty"`
	Enabled    bool   `json:"enabled,omitempty"`
	Event      string `json:"event,omitempty"`
	Id         int64  `json:"id,omitempty"`
	MatchMode  string `json:"match_mode,omitempty"`
	Medium     string `json:"medium,omitempty"`
	UserId     int64  `json:"user_id,omitempty"`
}

type NotificationResponses added in v1.0.1

type NotificationResponses []NotificationResponse

type Payment added in v1.0.1

type Payment struct {
	Id           int64           `json:"id,omitempty"`     // The payment’s unique ID
	Object       string          `json:"object,omitempty"` // Object type, payment
	Customer     int64           `json:"-"`
	CustomerFull *Customer       `json:"-"`
	CustomerRaw  json.RawMessage `json:"customer,omitempty"`
	Date         int64           `json:"date,omitempty"`   // Payment date, defaults to current timestamp
	Method       string          `json:"method,omitempty"` // Payment instrument used to facilitate payment, defaults to other
	Matched      bool            `json:"matched,omitempty"`
	Voided       bool            `json:"voided,omitempty"`
	Status       string          `json:"status,omitempty"`   // Payment status
	Currency     string          `json:"currency,omitempty"` // 3-letter ISO code
	Amount       float64         `json:"amount,omitempty"`   // Payment amount
	Balance      float64         `json:"balance,omitempty"`
	Reference    string          `json:"reference,omitempty"`
	Source       string          `json:"source,omitempty"`
	Notes        string          `json:"notes,omitempty"` // Internal notes
	Charge       *Charge         `json:"charge,omitempty"`
	PdfUrl       string          `json:"pdf_url,omitempty"`    // URL to download the invoice as a PDF
	CreatedAt    int64           `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt    int64           `json:"updated_at,omitempty"` // Timestamp when updated
	AppliedTo    []PaymentItem   `json:"applied_to,omitempty"`
}

func (*Payment) MarshalJSON added in v1.0.1

func (i *Payment) MarshalJSON() ([]byte, error)

func (*Payment) String added in v1.0.1

func (i *Payment) String() string

func (*Payment) UnmarshalJSON added in v1.0.1

func (i *Payment) UnmarshalJSON(data []byte) error

type PaymentItem added in v1.0.1

type PaymentItem struct {
	Type         string  `json:"type,omitempty"`
	Invoice      int64   `json:"invoice,omitempty"`
	CreditNote   int64   `json:"credit_note,omitempty"`
	Estimate     int64   `json:"estimate,omitempty"`
	DocumentType int64   `json:"document_type,omitempty"`
	Amount       float64 `json:"amount,omitempty"`
}

type PaymentPlan added in v1.0.1

type PaymentPlan struct {
	Id           int64                    `json:"id,omitempty"`
	Object       string                   `json:"object,omitempty"`
	Status       string                   `json:"status,omitempty"`
	Installments []PaymentPlanInstallment `json:"installments,omitempty"`
	Approval     *PaymentPlanApproval     `json:"approval,omitempty"`
	CreatedAt    int64                    `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt    int64                    `json:"updated_at,omitempty"`
}

type PaymentPlanApproval added in v1.0.1

type PaymentPlanApproval struct {
	Id        int64  `json:"id,omitempty"`
	Ip        string `json:"ip,omitempty"`
	Timestamp int64  `json:"timestamp,omitempty"`
	UserAgent string `json:"user_agent,omitempty"`
}

type PaymentPlanInstallment added in v1.0.1

type PaymentPlanInstallment struct {
	Amount  float64 `json:"amount,omitempty"`
	Balance float64 `json:"balance,omitempty"`
	Date    int64   `json:"date,omitempty"`
	Id      int64   `json:"id,omitempty"`
}

type PaymentPlanInstallments added in v1.0.1

type PaymentPlanInstallments []PaymentPlanInstallment

type PaymentPlanRequest added in v1.0.1

type PaymentPlanRequest struct {
	Installments []PaymentPlanInstallment `json:"installments,omitempty"`
}

type PaymentSource

type PaymentSource struct {
	*Card
	*BankAccount
	Method        string `json:"method,omitempty"`         // Method type, e.g. "card" or "bank_account"
	MakeDefault   bool   `json:"make_default,omitempty"`   // When true, makes payment source the default
	InvoicedToken string `json:"invoiced_token,omitempty"` // Optional, generated by invoiced.js
	GatewayToken  string `json:"gateway_token,omitempty"`  // Optional, generated by payment gateway
	Object        string `json:"object,omitempty"`
}

func (*PaymentSource) UnmarshalJSON added in v1.0.1

func (d *PaymentSource) UnmarshalJSON(data []byte) error

type PaymentSources added in v1.0.1

type PaymentSources []PaymentSource

type Payments added in v1.0.1

type Payments []Payment

type PendingLineItem added in v1.0.1

type PendingLineItem struct {
	Id           int64                  `json:"id,omitempty"`
	Item         string                 `json:"catalog_item,omitempty"` // Optional Item ID. Fills the line item with the name and pricing of the Item.
	Type         string                 `json:"type,omitempty"`         // Optional line item type. Used to group line items by type in reporting
	Name         string                 `json:"name,omitempty"`         // Title
	Description  string                 `json:"description,omitempty"`  // Optional description
	Quantity     float64                `json:"quantity,omitempty"`     // Quantity
	UnitCost     float64                `json:"unit_cost,omitempty"`    // Unit cost or rate
	Discountable bool                   `json:"discountable,omitempty"` // Excludes amount from invoice discounts when false, defaults to `true
	Discounts    []Discount             `json:"discounts,omitempty"`    // Line item Discounts
	Taxable      bool                   `json:"taxable,omitempty"`      // Excludes amount from invoice taxes when false, defaults to `true
	Taxes        []Tax                  `json:"taxes,omitempty"`        // Line item Taxes
	Metadata     map[string]interface{} `json:"metadata,omitempty"`     // A hash of key/value pairs that can store additional information about this object.
}

type PendingLineItems added in v1.0.1

type PendingLineItems []PendingLineItem

type Plan

type Plan struct {
	Id                    string                 `json:"id,omitempty"`
	Object                string                 `json:"object,omitempty"`
	Item                  string                 `json:"catalog_item,omitempty"`
	Name                  string                 `json:"name,omitempty"`
	Currency              string                 `json:"currency,omitempty"`
	Amount                float64                `json:"amount,omitempty"`
	PricingMode           string                 `json:"pricing_mode,omitempty"`
	QuantityType          string                 `json:"quantity_type,omitempty"`
	Interval              string                 `json:"interval,omitempty"`
	IntervalCount         float64                `json:"interval_count,omitempty"`
	Tiers                 []Tier                 `json:"tier,omitempty"`
	CreatedAt             int64                  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt             int64                  `json:"updated_at,omitempty"`
	Metadata              map[string]interface{} `json:"metadata,omitempty"`
	NumberOfSubscriptions *int                   `json:"num_subscriptions,omitempty"`
}

type Refund added in v1.0.1

type Refund struct {
	Id             int64   `json:"id,omitempty"`              // The payment’s unique ID
	Object         string  `json:"object,omitempty"`          // Object type, payment
	Charge         int64   `json:"charge,omitempty"`          // Charge ID
	Status         string  `json:"status,omitempty"`          // Payment status, one of succeeded, pending, or failed, defaults to succeeded
	Gateway        string  `json:"gateway,omitempty"`         // Payment gateway that processed the payment, if any
	GatewayId      string  `json:"gateway_id,omitempty"`      // Payment ID from the payment gateway, or check # if method is check
	Currency       string  `json:"currency,omitempty"`        // 3-letter ISO code
	Amount         float64 `json:"amount,omitempty"`          // Payment amount
	FailureMessage string  `json:"failure_message,omitempty"` // Failure message from the payment gateway (only available when status = failed)
	CreatedAt      int64   `json:"created_at,omitempty"`      //Timestamp when created
	UpdatedAt      int64   `json:"updated_at,omitempty"`      // Timestamp when updated
}

type RefundRequest added in v1.0.1

type RefundRequest struct {
	Amount float64 `json:"amount,omitempty"`
}

type Role added in v1.0.1

type Role struct {
	Id   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Roles added in v1.0.1

type Roles []Role

type ShippingDetail added in v1.0.1

type ShippingDetail struct {
	Name        string `json:"name,omitempty"`
	AttentionTo string `json:"attention_to,omitempty"` // Used for ATTN: address line if company
	Address1    string `json:"address1,omitempty"`     // First address line
	Address2    string `json:"address2,omitempty"`     // Optional second address line
	City        string `json:"city,omitempty"`         // City
	State       string `json:"state,omitempty"`        // State or province
	PostalCode  string `json:"postal_code,omitempty"`  // Zip or postal code
	Country     string `json:"country,omitempty"`      // Two-letter ISO code
}

type Sort

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

func NewSort

func NewSort() *Sort

func (*Sort) Set

func (s *Sort) Set(column string, order SortOrder)

func (*Sort) String

func (s *Sort) String() string

type SortOrder

type SortOrder int
const (
	ASC SortOrder = iota
	DESC
)

func (SortOrder) String

func (s SortOrder) String() string

type Subscription

type Subscription struct {
	Id                    int64                  `json:"id,omitempty"`     // The subscription’s unique ID
	Object                string                 `json:"object,omitempty"` // Object type, subscription
	Customer              int64                  `json:"-"`
	CustomerFull          *Customer              `json:"-"`
	CustomerRaw           json.RawMessage        `json:"customer,omitempty"`
	Amount                float64                `json:"amount,omitempty"` // The subscription's amount
	Plan                  string                 `json:"-"`                // Plan ID
	PlanFull              *Plan                  `json:"-"`
	PlanRaw               json.RawMessage        `json:"plan,omitempty"`
	StartDate             int64                  `json:"start_date,omitempty"` // Timestamp subscription starts (or started)
	BillIn                string                 `json:"bill_in,omitempty"`    // advance or arrears. Defaults to advance
	BillInAdvanceDays     int64                  `json:"bill_in_advance_days,omitempty"`
	Quantity              int64                  `json:"quantity,omitempty"`                // Plan quantity. Defaults to 1
	Cycles                int64                  `json:"cycles,omitempty"`                  // Number of billing cycles the subscription runs for, when null runs until canceled (default).
	PeriodStart           int64                  `json:"period_start,omitempty"`            // Start of the current billing period
	PeriodEnd             int64                  `json:"period_end,omitempty"`              // End of the current billing period
	SnapToNthDay          int                    `json:"snap_to_nth_day,omitempty"`         // Snap billing cycles to a specific day of the month (also known as calendar billing), off by default
	CancelAtPeriodEnd     bool                   `json:"cancel_at_period_end,omitempty"`    // When true the subscription will be canceled at the end of the current billing period
	CanceledAt            int64                  `json:"cancel_at,omitempty"`               // Timestamp the subscription was canceled
	Prorate               bool                   `json:"prorate,omitempty"`                 // Prorate changes to plan, quantities, or addons, defaults to true
	ProrationDate         int64                  `json:"proration_date,omitempty"`          // Timestamp when the proration happened, defaults to now
	Paused                bool                   `json:"paused"`                            // When true, subscription is paused
	ContractPeriodStart   int64                  `json:"contract_period_start,omitempty"`   // Start of current contract period
	ContractPeriodEnd     int64                  `json:"contract_period_end,omitempty"`     // End of current contract period
	ContractRenewalCycles int                    `json:"contract_renewal_cycles,omitempty"` // Number of billing cycles in next contract period
	ContractRenewalMode   string                 `json:"contract_renewal_mode,omitempty"`   // auto, manual, renew_once, or none. Defaults to none
	Status                string                 `json:"status,omitempty"`                  // Subscription status, one of not_started, active, past_due, finished
	RecurringTotal        float64                `json:"recurring_total,omitempty"`         // Total recurring amount (includes taxes)
	Mrr                   float64                `json:"MRR,omitempty"`                     // Monthly Recurring Revenue (MRR)`
	Addons                []SubscriptionAddon    `json:"addons,omitempty"`                  // Collection of Subscription Addons
	Discounts             []Discount             `json:"discount,omitempty"`                // Collection of Coupon IDs
	Taxes                 []Tax                  `json:"taxes,omitempty"`                   // Collection of Tax Rate ID
	ShipTo                *ShippingDetail        `json:"ship_to,omitempty"`
	Url                   string                 `json:"url,omitempty"`        // URL to manage the subscription in the billing portal
	CreatedAt             int64                  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt             int64                  `json:"updated_at,omitempty"` // Timestamp when updated
	Metadata              map[string]interface{} `json:"metadata,omitempty"`   // A hash of key/value pairs that can store additional information about this object.
}

func (*Subscription) MarshalJSON added in v1.0.1

func (i *Subscription) MarshalJSON() ([]byte, error)

func (*Subscription) String added in v1.0.1

func (s *Subscription) String() string

func (*Subscription) UnmarshalJSON added in v1.0.1

func (i *Subscription) UnmarshalJSON(data []byte) error

type SubscriptionAddon

type SubscriptionAddon struct {
	Id        int64   `json:"id,omitempty"`         // The subscription’s unique ID
	Amount    float64 `json:"amount,omitempty"`     // The subscription's amount
	Plan      string  `json:"plan,omitempty"`       // The Subscription's Plan ID
	Quantity  int64   `json:"quantity,omitempty"`   // Quantity
	CreatedAt int64   `json:"created_at,omitempty"` // Timestamp when created
}

type SubscriptionPreview added in v1.0.1

type SubscriptionPreview struct {
	FirstInvoice   *SubscriptionPreviewInvoice `json:"first_invoice,omitempty"`
	MRR            float64                     `json:"mrr,omitempty"`
	RecurringTotal float64                     `json:"recurring_total,omitempty"`
}

type SubscriptionPreviewInvoice added in v1.0.1

type SubscriptionPreviewInvoice struct {
	Customer           int64                  `json:"customer,omitempty"`             // Customer ID
	Name               string                 `json:"name,omitempty"`                 // Invoice name for internal use, defaults to “Invoice”
	Number             string                 `json:"number,omitempty"`               // The reference number assigned to the invoice for use in the dashboard
	AutoPay            bool                   `json:"autopay,omitempty"`              // Invoice collection mode, auto or manual
	Currency           string                 `json:"currency,omitempty"`             // 3-letter ISO code
	Draft              bool                   `json:"draft,omitempty"`                // When false, the invoice is considered outstanding, or when true, the invoice is a draft
	Closed             bool                   `json:"closed,omitempty"`               // When true, an invoice is closed and considered bad debt. No further payments are allowed.
	Paid               bool                   `json:"paid,omitempty"`                 // Indicates whether an invoice has been paid in full
	Status             string                 `json:"status,omitempty"`               // Invoice state, one of draft, not_sent, sent, viewed, past_due, pending, paid
	AttemptCount       int64                  `json:"attempt_count,omitempty"`        //# of payment attempts
	NextPaymentAttempt int64                  `json:"next_payment_attempt,omitempty"` // Next scheduled charge attempt, when in automatic collection
	Date               int64                  `json:"date,omitempty"`                 // Invoice date
	DueDate            int64                  `json:"due_date,omitempty"`             // Date payment is due by
	PaymentTerms       string                 `json:"payment_terms,omitempty"`        // Payment terms for the invoice, i.e. “NET 30”
	Items              []LineItemPreview      `json:"items,omitempty"`                // Collection of Line Items
	Notes              string                 `json:"notes,omitempty"`                // Additional notes displayed on invoice
	Subtotal           float64                `json:"subtotal,omitempty"`             // Subtotal
	Discounts          []Discount             `json:"discounts,omitempty"`            // Collection of Discounts
	Taxes              []Tax                  `json:"taxes,omitempty"`                // Collection of Taxes
	Total              float64                `json:"total,omitempty"`                // Total
	Balance            float64                `json:"balance,omitempty"`              // Balance owed
	Url                string                 `json:"url,omitempty"`                  // URL to view the invoice in the billing portal
	PaymentUrl         string                 `json:"payment_url,omitempty"`          // URL for the invoice payment page
	PdfUrl             string                 `json:"pdf_url,omitempty"`              // URL to download the invoice as a PDF
	CreatedAt          int64                  `json:"created_at,omitempty"`           //Timestamp when created
	UpdatedAt          int64                  `json:"updated_at,omitempty"`           // Timestamp when updated
	Metadata           map[string]interface{} `json:"metadata,omitempty"`             // A hash of key/value pairs that can store additional information about this object.
}

type SubscriptionPreviewRequest added in v1.0.1

type SubscriptionPreviewRequest struct {
	Customer         int64               `json:"customer,omitempty"`
	Plan             string              `json:"plan,omitempty"`
	Quantity         int                 `json:"quantity,omitempty"`
	Addons           []SubscriptionAddon `json:"addons,omitempty"`
	Discounts        []Discount          `json:"discounts,omitempty"`
	Taxes            []Tax               `json:"Taxes,omitempty"`
	PendingLineItems []PendingLineItem   `json:"pending_line_item,omitempty"`
}

type Subscriptions

type Subscriptions []Subscription

type Task added in v1.0.1

type Task struct {
	Id                int64  `json:"id,omitempty"`                   // The note’s unique ID
	Name              string `json:"name,omitempty"`                 // Name
	Action            string `json:"action,omitempty"`               // Action type, one of phone, letter, email, review
	CustomerId        int64  `json:"customer_id,omitempty"`          // Associated customer ID
	UserId            int64  `json:"user_id,omitempty"`              // ID of user assigned to task
	DueDate           int64  `json:"due_date,omitempty"`             // Task due date
	Complete          bool   `json:"complete,omitempty"`             // Task complete?
	CompletedDate     int64  `json:"completed_date,omitempty"`       // Date task was marked complete
	CompletedByUserId int64  `json:"completed_by_user_id,omitempty"` // User ID who completed task
	ChaseStepID       int64  `json:"chase_step_id,omitempty"`        // Chasing step ID that created task
	CreatedAt         int64  `json:"created_at,omitempty"`           //Timestamp when created
	UpdatedAt         int64  `json:"updated_at,omitempty"`           // Timestamp when updated

}

type Tasks added in v1.0.1

type Tasks []Task

type Tax

type Tax struct {
	Id      int64   `json:"id,omitempty"`       // The tax’s unique ID
	Amount  float64 `json:"amount,omitempty"`   // Tax amount
	TaxRate TaxRate `json:"tax_rate,omitempty"` // Tax Rate the tax was computed from, if any
}

type TaxRate added in v1.0.1

type TaxRate struct {
	Id        string                 `json:"id,omitempty"`
	Object    string                 `json:"object,omitempty"`
	Name      string                 `json:"name,omitempty"`
	Currency  string                 `json:"currency,omitempty"`
	Value     float64                `json:"value,omitempty"`
	IsPercent bool                   `json:"is_percent,omitempty"`
	Inclusive bool                   `json:"inclusive,omitempty"`
	CreatedAt int64                  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt int64                  `json:"updated_at,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

type TextDetail added in v1.0.1

type TextDetail struct {
	Name  string `json:"name,omitempty"`
	Phone string `json:"phone,omitempty"`
}

type TextRequest added in v1.0.1

type TextRequest struct {
	To      []TextDetail `json:"to,omitempty"`
	Message string       `json:"message,omitempty"`
	Type    string       `json:"type,omitempty"`
	Start   int64        `json:"start,omitempty"`
	End     int64        `json:"end,omitempty"`
	Items   string       `json:"items,omitempty"`
}

type TextResponse added in v1.0.1

type TextResponse struct {
	Id        string `json:"id,omitempty"`
	To        string `json:"to,omitempty"`
	State     string `json:"state,omitempty"`
	Message   string `json:"message,omitempty"`
	CreatedAt int64  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt int64  `json:"updated_at,omitempty"`
}

type TextResponses added in v1.0.1

type TextResponses []TextResponse

type Tier added in v1.0.1

type Tier struct {
	MaxQty   float64 `json:"max_qty,omitempty"`
	UnitCost float64 `json:"unit_cost,omitempty"`
	MinQty   float64 `json:"min_qty,omitempty"`
}

type User added in v1.0.1

type User struct {
	Email            string `json:"email,omitempty"`
	FirstName        string `json:"first_name,omitempty"`
	Id               int64  `json:"id,omitempty"`
	LastName         string `json:"last_name,omitempty"`
	Registered       bool   `json:"registered,omitempty"`
	TwoFactorEnabled bool   `json:"two_factor_enabled,omitempty"`
}

type UserEmailUpdateRequest added in v1.0.1

type UserEmailUpdateRequest struct {
	Id                   int64  `json:"id"`
	EmailUpdateFrequency string `json:"email_update_frequency"`
}

type UserInviteRequest added in v1.0.1

type UserInviteRequest struct {
	Id int64 `json:"id"`
}

type UserRequest added in v1.0.1

type UserRequest struct {
	Email           string              `json:"email,omitempty"`
	FirstName       string              `json:"first_name,omitempty"`
	LastName        string              `json:"last_name,omitempty"`
	Role            string              `json:"role,omitempty"`
	RestrictionMode string              `json:"restriction_mode,omitempty"`
	Restrictions    map[string][]string `json:"restrictions,omitempty"`
}

type UserRequests added in v1.0.1

type UserRequests []UserRequest

type UserResponse added in v1.0.1

type UserResponse struct {
	CreatedAt            int64               `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt            int64               `json:"updated_at,omitempty"`
	EmailUpdateFrequency string              `json:"email_update_frequency,omitempty"`
	Id                   int64               `json:"id,omitempty"`
	LastSignedIn         int64               `json:"last_accessed,omitempty"`
	RestrictionMode      string              `json:"restriction_mode,omitempty"`
	Restrictions         map[string][]string `json:"restrictions,omitempty"`
	Role                 string              `json:"role,omitempty"`
	User                 *User               `json:"user,omitempty"`
}

type WebhookAttempt added in v1.0.1

type WebhookAttempt struct {
	Attempts  []WebhookAttemptStatus `json:"attempts,omitempty"`
	CreatedAt int64                  `json:"created_at,omitempty"` //Timestamp when created
	UpdatedAt int64                  `json:"updated_at,omitempty"`
	EventId   int64                  `json:"event_id,omitempty"`
	Id        int64                  `json:"id,omitempty"`
	Payload   json.RawMessage        `json:"payload,omitempty"`
}

type WebhookAttemptStatus added in v1.0.1

type WebhookAttemptStatus struct {
	StatusCode int   `json:"status_code,omitempty"`
	Timestamp  int64 `json:"timestamp,omitempty"`
}

Jump to

Keyboard shortcuts

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