chargify

package module
v0.0.0-...-c6bab7a Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

go-chargify

Go wrapper for Chargify.

This wrapper currently supports creating, getting, updating, and cancelling Subscriptions, getting, updating, and deleting Customers, getting Products, and getting Components.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFound     = errors.New("not found")
	Unrecognized = errors.New("unrecognized response code")
)

Functions

func DeleteCustomer

func DeleteCustomer(client Client, customerID int64) (err error)

func GetStatemementIds

func GetStatemementIds(client Client, subscriptionId int64, pageNumber int32, perPage int32) ([]int64, error)

func NoID

func NoID() error

func WithBasicAuth

func WithBasicAuth(rt http.RoundTripper, apiKey string) *withBasicAuth

Types

type Allocation

type Allocation struct {
	Allocation *ComponentBody `json:"allocation,omitempty"`
}

type BankAccount

type BankAccount struct {
	ChargifyToken         string `json:"chargify_token,omitempty"`
	BankName              string `json:"bank_name,omitempty"`
	BankRoutingNumber     string `json:"bank_routing_number,omitempty"`
	BankAccountNumber     string `json:"bank_account_number,omitempty"`
	BankAccountType       string `json:"bank_account_type,omitempty"`
	BankBranchCode        string `json:"bank_branch_code,omitempty"`
	BankIBAN              string `json:"bank_iban,omitempty"`
	BankAccountHolderType string `json:"bank_account_holder_type,omitempty"`
}

type CalendarBilling

type CalendarBilling struct {
	SnapDay                    int64  `json:"snap_day,omitempty"`
	CalendarBillingFirstCharge string `json:"calendar_billing_first_charge,omitempty"`
}

type Client

type Client interface {
	Get(string) (*http.Response, error)
	Post([]byte, string) (*http.Response, error)
	Put([]byte, string) (*http.Response, error)
	Delete([]byte, string) (*http.Response, error)
	GenerateSelfServiceLink(string, int64) string
}

func NewClient

func NewClient(subdomain string) (Client, error)

type Component

type Component struct {
	Component *ComponentBody `json:"component,omitempty"`
}

func GetComponentAllocation

func GetComponentAllocation(client Client, subscriptionID int64, componentID int64) (component *Component, err error)

func UpdateComponentQuantity

func UpdateComponentQuantity(client Client, subscriptionID int64, componentID int64, quantity int64, upgradeCharge string, pricePointID int64) (component *Component, err error)

type ComponentBody

type ComponentBody struct {
	ID                        int64    `json:"id,omitempty"`
	Name                      string   `json:"name,omitempty"`
	Handle                    string   `json:"handle,omitempty"`
	PricingScheme             string   `json:"pricing_scheme,omitempty"`
	UnitName                  string   `json:"unit_name,omitempty"`
	UnitPrice                 string   `json:"unit_price,omitempty"`
	ProductFamilyID           int64    `json:"product_family_id,omitempty"`
	PricePerUnitInCents       int64    `json:"price_per_unit_in_cents,omitempty"`
	Kind                      string   `json:"kind,omitempty"`
	Archived                  bool     `json:"archived,omitempty"`
	Taxable                   bool     `json:"taxable,omitempty"`
	Description               string   `json:"description,omitempty"`
	DefaultPricePointID       int64    `json:"default_price_point_id,omitempty"`
	PricePointCount           int64    `json:"price_point_count,omitempty"`
	PricePointsURL            string   `json:"price_points_url,omitempty"`
	TaxCode                   string   `json:"tax_code,omitempty"`
	Recurring                 bool     `json:"recurring,omitempty"`
	UpgradeCharge             string   `json:"upgrade_charge,omitempty"`
	DowngradeCharge           string   `json:"downgrade_charge,omitempty"`
	CreatedAt                 string   `json:"created_at,omitempty"`
	Prices                    []*Price `json:"prices,omitempty"`
	Quantity                  int64    `json:"quantity,omitempty"`
	Timestamp                 string   `json:"timestamp,omitempty"`
	ProrationUpgradeScheme    string   `json:"proration_upgrade_scheme, omitempty"`
	ProrationDowngradeScheme  string   `json:"proration_downgrade_scheme,omitempty"`
	ProrationCollectionMethod string   `json:"proration_collection_method,omitempty"`
	// Response
	ComponentID       int64 `json:"component_id,omitempty"`
	SubscriptionID    int64 `json:"subscription_id,omitempty"`
	AllocatedQuantity int64 `json:"allocated_quantity, omitempty"`
	PricePointID      int64 `json:"price_point_id,omitempty"`
}

type CreditCard

type CreditCard struct {
	ChargifyToken      string `json:"chargify_token,omitempty"`
	ID                 int64  `json:"id,omitempty"`
	PaymentType        string `json:"payment_type,omitempty"`
	FirstName          string `json:"first_name,omitempty"`
	LastName           string `json:"last_name,omitempty"`
	MaskedCardNumber   string `json:"masked_card_number,omitempty"`
	FullNumber         string `json:"full_number,omitempty"`
	CardType           string `json:"card_type,omitempty"`
	ExpirationMonth    int64  `json:"expiration_month,omitempty"`
	ExpirationYear     int64  `json:"expiration_year,omitempty"`
	BillingAddress     string `json:"billing_address,omitempty"`
	BillingAddress2    string `json:"billing_address_2,omitempty"`
	BillingCity        string `json:"billing_city,omitempty"`
	BillingState       string `json:"billing_state,omitempty"`
	BillingCountry     string `json:"billing_country,omitempty"`
	BillingZIP         string `json:"billing_zip,omitempty"`
	CurrentVault       string `json:"current_vault,omitempty"`
	CustomerVaultToken string `json:"customer_vault_token,omitempty"`
	CustomerID         int64  `json:"customer_id,omitempty"`
	PaypalEmail        string `json:"paypal_email,omitempty"`
	PaypalMethodNonce  string `json:"paypal_method_nonce,omitempty"`
}

type Customer

type Customer struct {
	Customer *CustomerBody `json:"customer"`
}

func GetAllCustomers

func GetAllCustomers(client Client) (customers []*Customer, err error)

func GetCustomer

func GetCustomer(client Client, customerID int64) (customer *Customer, err error)

func GetCustomerByEmail

func GetCustomerByEmail(client Client, email string) (customers []*Customer, err error)

func (*Customer) Update

func (c *Customer) Update(client Client, customerID int64) (customer *Customer, err error)

type CustomerBody

type CustomerBody struct {
	FirstName                string       `json:"first_name,omitempty"`
	LastName                 string       `json:"last_name,omitempty"`
	Email                    string       `json:"email,omitempty"`
	CCEmails                 string       `json:"cc_emails,omitempty"`
	Organization             string       `json:"organization,omitempty"`
	Reference                string       `json:"reference,omitempty"`
	ID                       int64        `json:"id,omitempty"`
	CreatedAt                string       `json:"created_at,omitempty"`
	UpdatedAt                string       `json:"updated_at,omitempty"`
	Address                  string       `json:"address,omitempty"`
	Address2                 string       `json:"address_2,omitempty"`
	City                     string       `json:"city,omitempty"`
	State                    string       `json:"state,omitempty"`
	Zip                      string       `json:"zip"`
	Country                  string       `json:"country,omitempty"`
	Phone                    string       `json:"phone,omitempty"`
	Verfied                  bool         `json:"verfied,omitempty"`
	PortalCustomerCreatedAt  string       `json:"portal_customer_created_at,omitempty"`
	PortalInviteLastSend     string       `json:"portal_invite_last_send,omitempty"`
	PortalInviteLastAccepted string       `json:"portal_invite_last_accepted,omitempty"`
	TaxExampt                bool         `json:"tax_exampt,omitempty"`
	VatNumber                string       `json:"vat_number,omitempty"`
	ParentID                 int64        `json:"parent_id,omitempty"`
	Metafields               []*Metafield `json:"metafields,omitempty"`
}

type Error

type Error struct {
	Errors []string `json:"errors"`
}

func (*Error) Error

func (e *Error) Error() string

type Event

type Event struct {
	Id             int64  `json:"id,omitempty"`
	Key            string `json:"key,omitempty"`
	Message        string `json:"message,omitempty"`
	SubscriptionId int64  `json:"subscription_id,omitempty"`
	CreatedAt      string `json:"created_at,omitempty"`
}

type Events

type Events struct {
	Event *Event `json:"event,omitempty"`
}

type Metafield

type Metafield struct {
	MetafieldName string `json:"metafield_name,omitempty"`
}

type Migration

type Migration struct {
	Id        int64          `json:"-"`
	Migration *MigrationBody `json:"migration,omitempty"`
}

func (*Migration) Create

func (m *Migration) Create(client Client) (response *Migration, err error)

Migrate a subscription from one product to another. NOTE: This will not update any component price points associated with the product, so update those first.

func (*Migration) Preview

func (m *Migration) Preview(client Client) (response *MigrationResponse, err error)

Preview a migration before creating it.

type MigrationBody

type MigrationBody struct {
	ProductId               int64  `json:"product_id,omitempty"`
	ProductHandle           string `json:"product_handle,omitempty"`
	ProductPricePointId     int64  `json:"product_price_point_id,omitempty"`
	ProductPricePointHandle string `json:"product_price_point_handle,omitempty"`
	IncludeTrial            bool   `json:"include_trial,omitempty"`
	IncludeInitialCharge    bool   `json:"include_initial_charge,omitempty"`
	IncludeCoupons          bool   `json:"include_coupons,omitempty"`
	PreservePeriod          bool   `json:"preserve_period,omitempty"`
}

type MigrationPreview

type MigrationPreview struct {
	ProratedAdjustmentInCents int64 `json:"prorated_adjustment_in_cents,omitempty"`
	ChargeInCents             int64 `json:"charge_in_cents,omitempty"`
	PaymentDueInCents         int64 `json:"payment_due_in_cents,omitempty"`
	CreditAppliedInCents      int64 `json:"credit_applied_in_cents,omitempty"`
}

type MigrationResponse

type MigrationResponse struct {
	Migration *MigrationPreview `json:"migration"`
}

type PaymentProfile

type PaymentProfile struct {
	CustomerID         int64  `json:"customer_id,omitempty"`
	ChargifyToken      string `json:"chargify_token,omitempty"`
	ID                 int64  `json:"id,omitempty"`
	PaymentType        string `json:"payment_type,omitempty"`
	FirstName          string `json:"first_name,omitempty"`
	LastName           string `json:"last_name,omitempty"`
	MaskedCardNumber   string `json:"masked_card_number,omitempty"`
	FullNumber         string `json:"full_number,omitempty"`
	CardType           string `json:"card_type,omitempty"`
	ExpirationMonth    int64  `json:"expiration_month,omitempty"`
	ExpirationYear     int64  `json:"expiration_year,omitempty"`
	BillingAddress     string `json:"billing_address,omitempty"`
	BillingAddress2    string `json:"billing_address_2,omitempty"`
	BillingCity        string `json:"billing_city,omitempty"`
	BillingState       string `json:"billing_state,omitempty"`
	BillingCountry     string `json:"billing_country,omitempty"`
	BillingZIP         string `json:"billing_zip,omitempty"`
	CurrentVault       string `json:"current_vault,omitempty"`
	CustomerVaultToken string `json:"customer_vault_token,omitempty"`
	PaypalEmail        string `json:"paypal_email,omitempty"`
	PaypalMethodNonce  string `json:"paypal_method_nonce,omitempty"`
}

func (*PaymentProfile) Update

func (pp *PaymentProfile) Update(client Client) (response *PaymentProfileResponse, err error)

type PaymentProfileRequest

type PaymentProfileRequest struct {
	PaymentProfile *PaymentProfile `json:"payment_profile"`
}

type PaymentProfileResponse

type PaymentProfileResponse struct {
	Payment *PaymentProfileResponseBody `json:"payment"`
}

type PaymentProfileResponseBody

type PaymentProfileResponseBody struct {
	ID                     int64  `json:"id"`
	SubscriptionID         int64  `json:"subscription_id"`
	Type                   string `json:"type"`
	Kind                   string `json:"kind"`
	TransactionType        string `json:"transaction_type"`
	Success                bool   `json:"success"`
	AmountInCents          int64  `json:"amount_in_cents"`
	Memo                   string `json:"memo"`
	CreatedAt              string `json:"created_at"`
	StartingBalanceInCents int64  `json:"starting_balance_in_cents"`
	EndingBalanceInCents   int64  `json:"ending_balance_in_cents"`
	GatewayUsed            string `json:"gateway_used"`
	GatewayTransactionID   string `json:"gateway_transaction_id"`
	GatewayOrderID         string `json:"gateway_order_id"`
	PaymentID              string `json:"payment_id"`
	ProductID              int64  `json:"product_id"`
	TaxID                  string `json:"tax_id"`
	ComponentID            int64  `json:"component_id"`
	StatementID            int64  `json:"statement_id"`
	CustomerID             int64  `json:"customer_id"`
	CardNumber             string `json:"card_number"`
	CardExpiration         string `json:"card_expiration"`
	CardType               string `json:"card_type"`
	RefundedAmountInCents  string `json:"refunded_amount_in_cents"`
}

type Price

type Price struct {
	ID                  int64  `json:"id,omitempty"`
	StartingQuantity    int64  `json:"starting_quantity,omitempty"`
	EndingQuantity      int64  `json:"ending_quantity,omitempty"`
	UnitPrice           string `json:"unit_price,omitempty"`
	ComponentID         int64  `json:"component_id,omitempty"`
	PricePointID        int64  `json:"price_point_id,omitempty"`
	FormattedPricePoint string `json:"formatted_price_point,omitempty"`
}

type PricePoint

type PricePoint struct {
	PricePoint []*ComponentBody `json:"price_points,omitempty"`
}

func GetComponentPricePoints

func GetComponentPricePoints(client Client, componentID int64) (pricePoint *PricePoint, err error)

type Product

type Product struct {
	Product *ProductBody `json:"product"`
}

func CreateProduct

func CreateProduct(client Client, familyId int64, product *Product) (response *Product, err error)

func GetProductByHandle

func GetProductByHandle(client Client, handle string) (product *Product, err error)

func GetProductByID

func GetProductByID(client Client, productID int64) (product *Product, err error)

func GetProductsByFamily

func GetProductsByFamily(client Client, familyID int64) (products []*Product, err error)

type ProductBody

type ProductBody struct {
	ID                      int64             `json:"id,omitempty"`
	Name                    string            `json:"name,omitempty"`
	Handle                  string            `json:"handle,omitempty"`
	Description             string            `json:"description,omitempty"`
	AccountingCode          string            `json:"accounting_code,omitempty"`
	PriceInCents            int64             `json:"price_in_cents,omitempty"`
	Interval                int64             `json:"interval,omitempty"`
	IntervalUnit            string            `json:"interval_unit,omitempty"`
	InitialChargeInCents    int64             `json:"initial_charge_in_cents,omitempty"`
	ExpirationInterval      int64             `json:"expiration_interval,omitempty"`
	ExpirationIntervalUnit  string            `json:"expiration_interval_unit,omitempty"`
	TrialPriceInCents       int64             `json:"trial_price_in_cents,omitempty"`
	TrialInterval           int64             `json:"trial_interval,omitempty"`
	TrialIntervalUnit       string            `json:"trial_interval_unit,omitempty"`
	InitialChargeAfterTrial bool              `json:"initial_charge_after_trial,omitempty"`
	ReturnParams            string            `json:"return_params,omitempty"`
	RequestCreditCard       bool              `json:"request_credit_card,omitempty"`
	RequireCreditCard       bool              `json:"require_credit_card,omitempty"`
	CreatedAt               string            `json:"created_at,omitempty"`
	UpdatedAt               string            `json:"updated_at,omitempty"`
	ArchivedAt              string            `json:"archived_at,omitempty"`
	UpdateReturnURL         string            `json:"update_return_url,omitempty"`
	UpdateReturnParams      string            `json:"update_return_params,omitempty"`
	ProductFamily           *ProductFamily    `json:"product_family,omitempty"`
	ProductPricePointHandle string            `json:"product_price_point_handle,omitempty"`
	PublicSignupPage        *PublicSignupPage `json:"public_signup_page,omitempty"`
	Taxable                 bool              `json:"taxable,omitempty"`
	VersionNumber           int64             `json:"version_number,omitempty"`
}

type ProductFamily

type ProductFamily struct {
	ID          int64  `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Handle      string `json:"handle,omitempty"`
	AccountCode string `json:"account_code,omitempty"`
	Description string `json:"description,omitempty"`
}

type PublicSignupPage

type PublicSignupPage struct {
	ID  int64  `json:"id,omitempty"`
	URL string `json:"url,omitempty"`
}

type Statement

type Statement struct {
	Id                       int64          `json:"id,omitempty"`
	BasicHtmlView            string         `json:"basic_html_view,omitempty"`
	ClosedAt                 string         `json:"closed_at,omitempty"`
	CreatedAt                string         `json:"created_at,omitempty"`
	CustomerBillingAddress   string         `json:"customer_billing_address,omitempty"`
	CustomerBillingAddress2  string         `json:"customer_billing_address_2,omitempty"`
	CustomerBillingCity      string         `json:"customer_billing_city,omitempty"`
	CustomerBillingCountry   string         `json:"customer_billing_country,omitempty"`
	CustomerBillingState     string         `json:"customer_billing_state,omitempty"`
	CustomerBillingZip       string         `json:"customer_billing_zip,omitempty"`
	CustomerFirstName        string         `json:"customer_first_name,omitempty"`
	CustomerLastName         string         `json:"customer_last_name,omitempty"`
	CustomerOrganization     string         `json:"customer_organization,omitempty"`
	CustomerShippingAddress  string         `json:"customer_shipping_address,omitempty"`
	CustomerShippingAddress2 string         `json:"customer_shipping_address_2,omitempty"`
	CustomerShippingCity     string         `json:"customer_shipping_city,omitempty"`
	CustomerShippingCountry  string         `json:"customer_shipping_country,omitempty"`
	CustomerShippingState    string         `json:"customer_shipping_state,omitempty"`
	CustomerShippingZip      string         `json:"customer_shipping_zip,omitempty"`
	EndingBalanceInCents     int64          `json:"ending_balance_in_cents,omitempty"`
	HtmlView                 string         `json:"html_view,omitempty"`
	Memo                     string         `json:"memo,omitempty"`
	OpenedAt                 string         `json:"opened_at,omitempty"`
	SettledAt                string         `json:"settled_at,omitempty"`
	StartingBalanceInCents   int64          `json:"starting_balance_in_cents,omitempty"`
	SubscriptionId           int64          `json:"subscription_id,omitempty"`
	TextView                 string         `json:"text_view,omitempty"`
	UpdatedAt                string         `json:"updated_at,omitempty"`
	TotalInCents             int64          `json:"total_in_cents,omitempty"`
	Transactions             []*Transaction `json:"transactions,omitempty"`
	Events                   []*Events      `json:"events,omitempty"`
}

func GetStatement

func GetStatement(client Client, statementId int64) (statement *Statement, err error)

func GetSubscriptionStatements

func GetSubscriptionStatements(client Client, subscriptionId int64, pageNumber int32, perPage int32) ([]*Statement, error)

type SubscriptionCancel

type SubscriptionCancel struct {
	SubscriptionID      string
	CancellationMessage string `json:"cancellation_message,omitempty"`
	CancellationMethod  string `json:"cancellation_method,omitempty"`
	ReasonCode          string `json:"reason_code,omitempty"`
}

type SubscriptionComponent

type SubscriptionComponent struct {
	ComponentID       int64 `json:"component_id,omitempty"`
	Enabled           bool  `json:"enabled,omitempty"`
	UnitBalance       int64 `json:"unit_balance,omitempty"`
	AllocatedQuantity int64 `json:"allocated_quantity,omitempty"`
	PricePointID      int64 `json:"price_point_id,omitempty"`
}

type SubscriptionCreate

type SubscriptionCreate struct {
	ProductHandle                 string                   `json:"product_handle,omitempty"`
	ProductID                     string                   `json:"product_id,omitempty"`
	ProductPricePointHandle       string                   `json:"product_price_point_handle,omitempty"`
	Ref                           string                   `json:"ref,omitempty"`
	CouponCode                    string                   `json:"coupon_code,omitempty"`
	PaymentCollectionMethod       string                   `json:"payment_collection_method,omitempty"`
	ReceivesInvoiceEmails         bool                     `json:"receives_invoice_emails,omitempty"`
	NetTerms                      string                   `json:"net_terms,omitempty"`
	CustomerID                    string                   `json:"customer_id,omitempty"`
	NextBillingAt                 string                   `json:"next_billing_at,omitempty"`
	StoredCredentialTransactionID int64                    `json:"stored_credential_transaction_id,omitempty"`
	PaymentProfileID              string                   `json:"payment_profile_id,omitempty"`
	CustomerAttributes            *CustomerBody            `json:"customer_attributes,omitempty"`
	CreditCardAttributes          *CreditCard              `json:"credit_card_attributes,omitempty"`
	BankAccountAttributes         *BankAccount             `json:"bank_account_attributes,omitempty"`
	Components                    []*SubscriptionComponent `json:"components,omitempty"`
	CalendarBilling               *CalendarBilling         `json:"calendar_billing,omitempty"`
	Metafields                    *SubscriptionMetafields  `json:"metafields,omitempty"`
}

type SubscriptionMetafields

type SubscriptionMetafields struct {
	Color    string `json:"color,omitempty"`
	Comments string `json:"comments,omitempty"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	Request       *SubscriptionCreate
	CancelRequest *SubscriptionCancel
}

func (*SubscriptionRequest) CancelDelayed

func (req *SubscriptionRequest) CancelDelayed(client Client) (err error)

func (*SubscriptionRequest) CancelNow

func (req *SubscriptionRequest) CancelNow(client Client) (response *SubscriptionResponse, err error)

func (*SubscriptionRequest) Create

func (req *SubscriptionRequest) Create(client Client) (response *SubscriptionResponse, err error)

func (*SubscriptionRequest) Update

func (req *SubscriptionRequest) Update(client Client, subscriptionID int64) (response *SubscriptionResponse, err error)

type SubscriptionResponse

type SubscriptionResponse struct {
	ID                            int64         `json:"id,omitempty"`
	State                         string        `json:"state,omitempty"`
	BalanceInCents                int64         `json:"balance_in_cents,omitempty"`
	TotalRevenueInCents           int64         `json:"total_revenue_in_cents,omitempty"`
	ProductPriceInCents           int64         `json:"product_price_in_cents,omitempty"`
	ProductVersionNumber          int64         `json:"product_version_number,omitempty"`
	CurrentPeriodEndsAt           string        `json:"current_period_ends_at,omitempty"`
	NextAssessmentAt              string        `json:"next_assessment_at,omitempty"`
	TrialStartedAt                string        `json:"trial_started_at,omitempty"`
	TrialEndedAt                  string        `json:"trial_ended_at,omitempty"`
	ActivatedAt                   string        `json:"activated_at,omitempty"`
	CreatedAt                     string        `json:"created_at,omitempty"`
	UpdatedAt                     string        `json:"updated_at,omitempty"`
	CancellationMessage           string        `json:"cancellation_message,omitempty"`
	CancellationMethod            string        `json:"cancellation_method,omitempty"`
	CancelAtEndOfPeriod           bool          `json:"cancel_at_end_of_period,omitempty"`
	CanceledAt                    string        `json:"canceled_at,omitempty"`
	CurrentPeriodStartedAt        string        `json:"current_period_started_at,omitempty"`
	PreviousState                 string        `json:"previous_state,omitempty"`
	SignupPaymentID               int64         `json:"signup_payment_id,omitempty"`
	SignupRevenue                 string        `json:"signup_revenue,omitempty"`
	DelayedCancelAt               string        `json:"delayed_cancel_at,omitempty"`
	CouponCode                    string        `json:"coupon_code,omitempty"`
	PaymentCollectionMethod       string        `json:"payment_collection_method,omitempty"`
	SnapDay                       string        `json:"snap_day,omitempty"`
	ReasonCode                    string        `json:"reason_code,omitempty"`
	ReceivesInvoiceEmails         bool          `json:"receives_invoice_emails,omitempty"`
	Customer                      *CustomerBody `json:"customer,omitempty"`
	Product                       *ProductBody  `json:"product,omitempty"`
	ProductPricePointID           int64         `json:"product_price_point_id,omitempty"`
	CreditCard                    *CreditCard   `json:"credit_card,omitempty"`
	PaymentType                   string        `json:"payment_type,omitempty"`
	ReferralCode                  string        `json:"referral_code,omitempty"`
	NextProductID                 int64         `json:"next_product_id,omitempty"`
	CouponUseCount                int64         `json:"coupon_use_count,omitempty"`
	CouponUsesAllowed             int64         `json:"coupon_uses_allowed,omitempty"`
	NextProductHandle             string        `json:"next_product_handle,omitempty"`
	StoredCredentialTransactionID int64         `json:"stored_credential_transaction_id,omitempty"`
}

func GetCustomerSubscriptions

func GetCustomerSubscriptions(client Client, customerID int64) (subscriptions []*SubscriptionResponse, err error)

func GetSubscription

func GetSubscription(client Client, subscriptionID int64) (response *SubscriptionResponse, err error)

func ReactivateSubscription

func ReactivateSubscription(client Client, subscriptionID int64) (response *SubscriptionResponse, err error)

func ResumeSubscription

func ResumeSubscription(client Client, subscriptionID int64) (response *SubscriptionResponse, err error)

type TaxRule

type TaxRule struct {
	CountryCode      string `json:"country_code,omitempty"`
	SubdivisionName  string `json:"subdivision_name,omitempty"`
	Rate             string `json:"rate,omitempty"`
	TaxAmountInCents int64  `json:"tax_amount_in_cents,omitempty"`
	Description      string `json:"description,omitempty"`
}

type Taxation

type Taxation struct {
	TaxChargeId           int64      `json:"tax_charge_id,omitempty"`
	TaxName               string     `json:"tax_name,omitempty"`
	Rate                  string     `json:"rate,omitempty"`
	TaxAmountInCents      int64      `json:"tax_amount_in_cents,omitempty"`
	TaxRules              []*TaxRule `json:"tax_rules,omitempty"`
	CardNumber            string     `json:"card_number,omitempty"`
	CardExpiration        string     `json:"card_expiration,omitempty"`
	CardType              string     `json:"card_type,omitempty"`
	RefundedAmountInCents int64      `json:"refunded_amount_in_cents,omitempty"`
}

type Transaction

type Transaction struct {
	Id                     int64       `json:"id,omitempty"`
	SubscriptionId         int64       `json:"subscription_id,omitempty"`
	Type                   string      `json:"type,omitempty"`
	Kind                   string      `json:"kind,omitempty"`
	TransactionType        string      `json:"transaction_type,omitempty"`
	Success                bool        `json:"success,omitempty"`
	AmountInCents          int64       `json:"amount_in_cents,omitempty"`
	Memo                   string      `json:"memo,omitempty"`
	CreatedAt              string      `json:"created_at,omitempty"`
	StartingBalanceInCents int64       `json:"starting_balance_in_cents,omitempty"`
	EndingBalanceInCents   int64       `json:"ending_balance_in_cents,omitempty"`
	GatewayUsed            string      `json:"gateway_used,omitempty"`
	GatewayTransactionId   string      `json:"gateway_transaction_id,omitempty"`
	GatewayOrderId         string      `json:"gateway_order_id,omitempty"`
	PaymentId              int64       `json:"payment_id,omitempty"`
	ProductId              int64       `json:"product_id,omitempty"`
	ComponentId            int64       `json:"component_id,omitempty"`
	StatementId            int64       `json:"statement_id,omitempty"`
	CustomerId             int64       `json:"customer_id,omitempty"`
	ItemName               string      `json:"item_name,omitempty"`
	OriginalAmountInCents  int64       `json:"original_amount_in_cents,omitempty"`
	DiscountAmountInCents  int64       `json:"discount_amount_in_cents,omitempty"`
	TaxableAmountInCents   int64       `json:"taxable_amount_in_cents,omitempty"`
	Taxations              []*Taxation `json:"taxations,omitempty"`
}

Directories

Path Synopsis
Package mock_chargify is a generated GoMock package.
Package mock_chargify is a generated GoMock package.

Jump to

Keyboard shortcuts

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