Documentation ¶
Index ¶
- Constants
- type APIResponseRelationshipsCheckout
- type APIResponseRelationshipsDiscount
- type APIResponseRelationshipsOrder
- type APIResponseRelationshipsPrice
- type APIResponseRelationshipsVariant
- type ApiResponse
- type ApiResponseData
- type ApiResponseDataWithoutRelationships
- type ApiResponseJSONAPI
- type ApiResponseLink
- type ApiResponseLinks
- type ApiResponseList
- type ApiResponseListLink
- type ApiResponseListMeta
- type ApiResponseListMetaPage
- type ApiResponseMetaSubscriptionItemCurrentUsage
- type ApiResponseRelationshipWebhook
- type ApiResponseRelationshipsCustomer
- type ApiResponseRelationshipsDiscountRedemption
- type ApiResponseRelationshipsFile
- type ApiResponseRelationshipsLicenseKey
- type ApiResponseRelationshipsLicenseKeyInstance
- type ApiResponseRelationshipsOrderItem
- type ApiResponseRelationshipsProduct
- type ApiResponseRelationshipsStore
- type ApiResponseRelationshipsSubscription
- type ApiResponseRelationshipsSubscriptionInvoice
- type ApiResponseRelationshipsSubscriptionItem
- type ApiResponseSelfLink
- type ApiResponseWithoutRelationships
- type BillingAddress
- type CheckoutAPIResponse
- type CheckoutAttributes
- type CheckoutCreateAttributes
- type CheckoutCreateData
- type CheckoutCreateDataQuantity
- type CheckoutCreateOptions
- type CheckoutCreateProductOptions
- type CheckoutData
- type CheckoutOptions
- type CheckoutPreview
- type CheckoutProductOptions
- type CheckoutsAPIResponse
- type CheckoutsService
- func (service *CheckoutsService) Create(ctx context.Context, storeID int, variantID int, ...) (*CheckoutAPIResponse, *Response, error)
- func (service *CheckoutsService) Get(ctx context.Context, checkoutID string) (*CheckoutAPIResponse, *Response, error)
- func (service *CheckoutsService) List(ctx context.Context) (*CheckoutsAPIResponse, *Response, error)
- type Client
- type CustomerApiResponse
- type CustomerAttributes
- type CustomersApiResponse
- type CustomersService
- type DiscountAPIResponse
- type DiscountAttributes
- type DiscountCreateParams
- type DiscountRedemptionApiResponse
- type DiscountRedemptionAttributes
- type DiscountRedemptionsApiResponse
- type DiscountRedemptionsService
- type DiscountsAPIResponse
- type DiscountsService
- func (service *DiscountsService) Create(ctx context.Context, params *DiscountCreateParams) (*DiscountAPIResponse, *Response, error)
- func (service *DiscountsService) Delete(ctx context.Context, discountID string) (*Response, error)
- func (service *DiscountsService) Get(ctx context.Context, discountID string) (*DiscountAPIResponse, *Response, error)
- func (service *DiscountsService) List(ctx context.Context) (*DiscountsAPIResponse, *Response, error)
- type FileApiResponse
- type FileAttributes
- type FilesApiResponse
- type FilesService
- type LicenseActivateApiResponse
- type LicenseAttributes
- type LicenseDeactivateApiResponse
- type LicenseInstance
- type LicenseKey
- type LicenseKeyApiResponse
- type LicenseKeyAttributes
- type LicenseKeyInstanceApiResponse
- type LicenseKeyInstanceAttributes
- type LicenseKeyInstancesApiResponse
- type LicenseKeyInstancesService
- type LicenseKeysApiResponse
- type LicenseKeysService
- type LicenseMeta
- type LicenseValidateApiResponse
- type LicensesService
- func (service *LicensesService) Activate(ctx context.Context, licenseKey, instanceName string) (*LicenseActivateApiResponse, *Response, error)
- func (service *LicensesService) Deactivate(ctx context.Context, licenseKey, instanceID string) (*LicenseDeactivateApiResponse, *Response, error)
- func (service *LicensesService) Validate(ctx context.Context, licenseKey, instanceID string) (*LicenseValidateApiResponse, *Response, error)
- type Option
- type OrderAPIResponse
- type OrderAttributes
- type OrderItemApiResponse
- type OrderItemAttributes
- type OrderItemsApiResponse
- type OrderItemsService
- type OrdersAPIResponse
- type OrdersService
- type PriceAPIResponse
- type PriceAttributes
- type PriceAttributesTiers
- type PricesAPIResponse
- type PricesService
- type ProductApiResponse
- type ProductAttributes
- type ProductsApiResponse
- type ProductsService
- type Resource
- type Response
- type StoreApiResponse
- type StoreAttributes
- type StoresApiResponse
- type StoresService
- type Subscription
- type SubscriptionApiResponse
- type SubscriptionFirstSubscriptionItem
- type SubscriptionInvoiceApiResponse
- type SubscriptionInvoiceAttributes
- type SubscriptionInvoicesApiResponse
- type SubscriptionInvoicesService
- type SubscriptionItem
- type SubscriptionItemApiResponse
- type SubscriptionItemCurrentUsageApiResponse
- type SubscriptionItemListParams
- type SubscriptionItemUpdateParams
- type SubscriptionItemUpdateParamsAttributes
- type SubscriptionItemsApiResponse
- type SubscriptionItemsService
- func (service *SubscriptionItemsService) CurrentUsage(ctx context.Context, subscriptionItemID string) (*SubscriptionItemCurrentUsageApiResponse, *Response, error)
- func (service *SubscriptionItemsService) Get(ctx context.Context, subscriptionItemID string) (*SubscriptionItemApiResponse, *Response, error)
- func (service *SubscriptionItemsService) List(ctx context.Context, queryParams map[string]string) (*SubscriptionItemsApiResponse, *Response, error)
- func (service *SubscriptionItemsService) Update(ctx context.Context, params *SubscriptionItemUpdateParams) (*SubscriptionItemApiResponse, *Response, error)
- type SubscriptionPause
- type SubscriptionURLs
- type SubscriptionUpdateParams
- type SubscriptionUpdateParamsAttributes
- type SubscriptionsApiResponse
- type SubscriptionsService
- func (service *SubscriptionsService) Cancel(ctx context.Context, subscriptionID string) (*SubscriptionApiResponse, *Response, error)
- func (service *SubscriptionsService) Get(ctx context.Context, subscriptionID string) (*SubscriptionApiResponse, *Response, error)
- func (service *SubscriptionsService) List(ctx context.Context) (*SubscriptionsApiResponse, *Response, error)
- func (service *SubscriptionsService) Update(ctx context.Context, params *SubscriptionUpdateParams) (*SubscriptionApiResponse, *Response, error)
- type UserApiResponse
- type UserAttributes
- type UsersService
- type VariantAPIResponse
- type VariantAttributes
- type VariantsAPIResponse
- type VariantsService
- type WebhookApiResponse
- type WebhookAttributes
- type WebhookCreateParams
- type WebhookRequest
- type WebhookRequestData
- type WebhookRequestLicenseKey
- type WebhookRequestMeta
- type WebhookRequestOrder
- type WebhookRequestSubscription
- type WebhookRequestSubscriptionInvoice
- type WebhookUpdateParams
- type WebhooksApiResponse
- type WebhooksService
- func (service *WebhooksService) Create(ctx context.Context, storeId int, params *WebhookCreateParams) (*WebhookApiResponse, *Response, error)
- func (service *WebhooksService) Delete(ctx context.Context, webhookID string) (*Response, error)
- func (service *WebhooksService) Get(ctx context.Context, webhookID string) (*WebhookApiResponse, *Response, error)
- func (service *WebhooksService) List(ctx context.Context) (*WebhooksApiResponse, *Response, error)
- func (service *WebhooksService) Update(ctx context.Context, params *WebhookUpdateParams) (*WebhookApiResponse, *Response, error)
- func (service *WebhooksService) Verify(_ context.Context, signature string, body []byte) bool
Constants ¶
const ( // WebhookEventOrderCreated occurs when a new order is successfully placed. WebhookEventOrderCreated = "order_created" // WebhookEventOrderRefunded occurs when a full or partial refund is made on an order. WebhookEventOrderRefunded = "order_refunded" // WebhookEventSubscriptionCreated occurs when a new subscription is successfully created. WebhookEventSubscriptionCreated = "subscription_created" // WebhookEventSubscriptionUpdated occurs when a subscription's data is changed or updated. WebhookEventSubscriptionUpdated = "subscription_updated" // WebhookEventSubscriptionCancelled occurs when a subscription is cancelled manually by the customer or store owner. WebhookEventSubscriptionCancelled = "subscription_cancelled" // WebhookEventSubscriptionResumed occurs when a subscription is resumed after being previously cancelled. WebhookEventSubscriptionResumed = "subscription_resumed" // WebhookEventSubscriptionExpired occurs when a subscription has ended after being previously cancelled, or once dunning has been completed for past_due subscriptions. WebhookEventSubscriptionExpired = "subscription_expired" // WebhookEventSubscriptionPaused occurs when a subscription's payment collection is paused. WebhookEventSubscriptionPaused = "subscription_paused" // WebhookEventSubscriptionUnpaused occurs when a subscription's payment collection is resumed after being previously paused. WebhookEventSubscriptionUnpaused = "subscription_unpaused" // WebhookEventSubscriptionPaymentSuccess occurs when a subscription payment is successful. WebhookEventSubscriptionPaymentSuccess = "subscription_payment_success" // WebhookEventSubscriptionPaymentFailed occurs when a subscription renewal payment fails. WebhookEventSubscriptionPaymentFailed = "subscription_payment_failed" // WebhookEventSubscriptionPaymentRecovered occurs when a subscription has a successful payment after a failed payment. WebhookEventSubscriptionPaymentRecovered = "subscription_payment_recovered" // WebhookEventSubscriptionPaymentRefunded occurs when a subscription payment is refunded. WebhookEventSubscriptionPaymentRefunded = "subscription_payment_refunded" // WebhookEventLicenseKeyCreated occurs when a license key is created from a new order. WebhookEventLicenseKeyCreated = "license_key_created" // WebhookEventLicenseKeyUpdated occurs when a license key is updated. WebhookEventLicenseKeyUpdated = "license_key_updated" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponseRelationshipsCheckout ¶ added in v1.2.2
type APIResponseRelationshipsCheckout struct { Store ApiResponseLinks `json:"store"` Variant ApiResponseLinks `json:"variant"` }
APIResponseRelationshipsCheckout relationships of a checkout
type APIResponseRelationshipsDiscount ¶ added in v1.2.2
type APIResponseRelationshipsDiscount struct { Store ApiResponseLinks `json:"store"` DiscountRedemptions ApiResponseLinks `json:"discount-redemptions"` Variants ApiResponseLinks `json:"variants"` }
APIResponseRelationshipsDiscount relationships of a discount
type APIResponseRelationshipsOrder ¶ added in v1.2.0
type APIResponseRelationshipsOrder struct { Store ApiResponseLinks `json:"store"` Customer ApiResponseLinks `json:"customer"` OrderItems ApiResponseLinks `json:"order-items"` Subscriptions ApiResponseLinks `json:"subscriptions"` LicenseKeys ApiResponseLinks `json:"license-keys"` DiscountRedemptions ApiResponseLinks `json:"discount-redemptions"` }
APIResponseRelationshipsOrder relationships of an order
type APIResponseRelationshipsPrice ¶ added in v1.2.0
type APIResponseRelationshipsPrice struct {
Variant ApiResponseLinks `json:"variant"`
}
APIResponseRelationshipsPrice relationships of a variant
type APIResponseRelationshipsVariant ¶ added in v1.2.0
type APIResponseRelationshipsVariant struct {
Product ApiResponseLinks `json:"product"`
}
APIResponseRelationshipsVariant relationships of a variant
type ApiResponse ¶
type ApiResponse[T any, R any] struct { Jsonapi ApiResponseJSONAPI `json:"jsonapi"` Links ApiResponseSelfLink `json:"links"` Data ApiResponseData[T, R] `json:"data"` }
ApiResponse represents an API response
type ApiResponseData ¶
type ApiResponseData[T any, R any] struct { Type string `json:"type"` ID string `json:"id"` Attributes T `json:"attributes"` Relationships R `json:"relationships"` Links ApiResponseSelfLink `json:"links"` }
ApiResponseData contains the api response data
type ApiResponseDataWithoutRelationships ¶ added in v0.0.4
type ApiResponseDataWithoutRelationships[T any] struct { Type string `json:"type"` ID string `json:"id"` Attributes T `json:"attributes"` Links ApiResponseSelfLink `json:"links"` }
ApiResponseDataWithoutRelationships contains the api response data without any relationships
type ApiResponseJSONAPI ¶
type ApiResponseJSONAPI struct {
Version string `json:"version"`
}
ApiResponseJSONAPI API version
type ApiResponseLink ¶
ApiResponseLink defines a link
type ApiResponseLinks ¶
type ApiResponseLinks struct {
Links ApiResponseLink `json:"links"`
}
ApiResponseLinks contains links to related resources
type ApiResponseList ¶ added in v0.0.3
type ApiResponseList[T any, R any] struct { Jsonapi ApiResponseJSONAPI `json:"jsonapi"` Links ApiResponseListLink `json:"links"` Meta ApiResponseListMeta `json:"meta"` Data []ApiResponseData[T, R] `json:"data"` }
ApiResponseList represents an API response with a list of items
type ApiResponseListLink ¶ added in v0.0.3
type ApiResponseListLink struct { First string `json:"first"` Last string `json:"last"` Next *string `json:"next"` }
ApiResponseListLink defines a link for list os resources
type ApiResponseListMeta ¶ added in v0.0.3
type ApiResponseListMeta struct {
Page ApiResponseListMetaPage `json:"page"`
}
ApiResponseListMeta defines the meta data for a list api response
type ApiResponseListMetaPage ¶ added in v0.0.3
type ApiResponseListMetaPage struct { CurrentPage int `json:"currentPage"` From int `json:"from"` LastPage int `json:"lastPage"` PerPage int `json:"perPage"` To int `json:"to"` Total int `json:"total"` }
ApiResponseListMetaPage defines the pagination meta data for a list api response
type ApiResponseMetaSubscriptionItemCurrentUsage ¶ added in v1.0.4
type ApiResponseRelationshipWebhook ¶ added in v0.0.12
type ApiResponseRelationshipWebhook struct {
Store ApiResponseLinks `json:"store"`
}
ApiResponseRelationshipWebhook relationships of a webhook
type ApiResponseRelationshipsCustomer ¶ added in v0.0.5
type ApiResponseRelationshipsCustomer struct { Store ApiResponseLinks `json:"store"` Subscriptions ApiResponseLinks `json:"subscriptions"` Orders ApiResponseLinks `json:"orders"` LicenseKeys ApiResponseLinks `json:"license-keys"` }
ApiResponseRelationshipsCustomer relationships of a customer
type ApiResponseRelationshipsDiscountRedemption ¶ added in v0.0.8
type ApiResponseRelationshipsDiscountRedemption struct { Discount ApiResponseLinks `json:"discount"` Order ApiResponseLinks `json:"order"` }
ApiResponseRelationshipsDiscountRedemption relationships of a discount redemption
type ApiResponseRelationshipsFile ¶ added in v0.0.6
type ApiResponseRelationshipsFile struct {
Variant ApiResponseLinks `json:"variant"`
}
ApiResponseRelationshipsFile relationships of a file
type ApiResponseRelationshipsLicenseKey ¶ added in v0.0.11
type ApiResponseRelationshipsLicenseKey struct { Store ApiResponseLinks `json:"store"` Customer ApiResponseLinks `json:"customer"` Order ApiResponseLinks `json:"order"` OrderItem ApiResponseLinks `json:"order-item"` Product ApiResponseLinks `json:"product"` LicenseKeyInstances ApiResponseLinks `json:"license-key-instances"` }
ApiResponseRelationshipsLicenseKey relationships of a license key
type ApiResponseRelationshipsLicenseKeyInstance ¶ added in v0.0.11
type ApiResponseRelationshipsLicenseKeyInstance struct {
LicenseKey ApiResponseLinks `json:"license-key"`
}
ApiResponseRelationshipsLicenseKeyInstance relationships of a license key
type ApiResponseRelationshipsOrderItem ¶ added in v0.0.7
type ApiResponseRelationshipsOrderItem struct { Order ApiResponseLinks `json:"order"` Product ApiResponseLinks `json:"product"` Variant ApiResponseLinks `json:"variant"` }
ApiResponseRelationshipsOrderItem relationships of an order-item
type ApiResponseRelationshipsProduct ¶ added in v0.0.5
type ApiResponseRelationshipsProduct struct { Store ApiResponseLinks `json:"store"` Variants ApiResponseLinks `json:"variants"` }
ApiResponseRelationshipsProduct relationships of a product
type ApiResponseRelationshipsStore ¶ added in v0.0.4
type ApiResponseRelationshipsStore struct { Subscriptions ApiResponseLinks `json:"subscriptions"` Orders ApiResponseLinks `json:"orders"` Products ApiResponseLinks `json:"products"` LicenseKeys ApiResponseLinks `json:"license-keys"` Discounts ApiResponseLinks `json:"discounts"` }
ApiResponseRelationshipsStore relationships of a store object
type ApiResponseRelationshipsSubscription ¶ added in v0.0.3
type ApiResponseRelationshipsSubscription struct { Store ApiResponseLinks `json:"store"` Customer ApiResponseLinks `json:"customer"` Order ApiResponseLinks `json:"order"` OrderItem ApiResponseLinks `json:"order-item"` Product ApiResponseLinks `json:"product"` Variant ApiResponseLinks `json:"variant"` SubscriptionItems ApiResponseLinks `json:"subscription-items"` SubscriptionInvoices ApiResponseLinks `json:"subscription-invoices"` }
ApiResponseRelationshipsSubscription relationships of a subscription object
type ApiResponseRelationshipsSubscriptionInvoice ¶ added in v0.0.8
type ApiResponseRelationshipsSubscriptionInvoice struct { Store ApiResponseLinks `json:"store"` Subscription ApiResponseLinks `json:"subscription"` }
ApiResponseRelationshipsSubscriptionInvoice relationships of a subscription invoice
type ApiResponseRelationshipsSubscriptionItem ¶ added in v1.0.3
type ApiResponseRelationshipsSubscriptionItem struct { Subscription ApiResponseLinks `json:"subscription"` Price ApiResponseLinks `json:"price"` UsageRecords ApiResponseLinks `json:"usage-records"` }
ApiResponseRelationshipsSubscription relationships of a subscription item object
type ApiResponseSelfLink ¶ added in v0.0.4
type ApiResponseSelfLink struct {
Self string `json:"self"`
}
ApiResponseSelfLink defines a link
type ApiResponseWithoutRelationships ¶ added in v0.0.4
type ApiResponseWithoutRelationships[T any] struct { Jsonapi ApiResponseJSONAPI `json:"jsonapi"` Links ApiResponseSelfLink `json:"links"` Data ApiResponseDataWithoutRelationships[T] `json:"data"` }
ApiResponseWithoutRelationships represents an API response without relationships
type BillingAddress ¶ added in v0.0.10
BillingAddress contains the checkout billing address
type CheckoutAPIResponse ¶ added in v1.2.2
type CheckoutAPIResponse = ApiResponse[CheckoutAttributes, APIResponseRelationshipsDiscount]
CheckoutAPIResponse is the api response for one checkout
type CheckoutAttributes ¶ added in v0.0.10
type CheckoutAttributes struct { StoreID int `json:"store_id"` VariantID int `json:"variant_id"` CustomPrice interface{} `json:"custom_price"` ProductOptions CheckoutProductOptions `json:"product_options"` CheckoutOptions CheckoutOptions `json:"checkout_options"` CheckoutData CheckoutData `json:"checkout_data"` ExpiresAt *time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` URL string `json:"url"` }
CheckoutAttributes contains information about a percentage or amount discount that can be applied to an order at checkout via a code.
type CheckoutCreateAttributes ¶ added in v1.1.0
type CheckoutCreateAttributes struct { CustomPrice *int `json:"custom_price,omitempty"` ProductOptions CheckoutCreateProductOptions `json:"product_options,omitempty"` CheckoutOptions CheckoutCreateOptions `json:"checkout_options,omitempty"` CheckoutData CheckoutCreateData `json:"checkout_data,omitempty"` Preview *bool `json:"preview,omitempty"` TestMode *bool `json:"test_mode,omitempty"` ExpiresAt *string `json:"expires_at,omitempty"` }
CheckoutCreateAttributes represents individual parameters for creating a checkout.
type CheckoutCreateData ¶ added in v1.1.0
type CheckoutCreateData struct { Email string `json:"email,omitempty"` Name string `json:"name,omitempty"` BillingAddressCountry string `json:"billing_address.country,omitempty"` BillingAddressZip string `json:"billing_address.zip,omitempty"` TaxNumber string `json:"tax_number,omitempty"` DiscountCode string `json:"discount_code,omitempty"` Custom map[string]any `json:"custom,omitempty"` VariantQuantities []CheckoutCreateDataQuantity `json:"variant_quantities,omitempty"` }
CheckoutCreateData represents the data options for creating a checkout.
type CheckoutCreateDataQuantity ¶ added in v1.1.0
type CheckoutCreateDataQuantity struct { VariantID int `json:"variant_id"` Quantity int `json:"quantity"` }
CheckoutCreateDataQuantity represents variant quantities when creating checkout
type CheckoutCreateOptions ¶ added in v1.1.0
type CheckoutCreateOptions struct { Embed *bool `json:"embed,omitempty"` Media *bool `json:"media,omitempty"` Logo *bool `json:"logo,omitempty"` Desc *bool `json:"desc,omitempty"` Discount *bool `json:"discount,omitempty"` Dark *bool `json:"dark,omitempty"` SubscriptionPreview *bool `json:"subscription_preview,omitempty"` ButtonColor string `json:"button_color,omitempty"` }
CheckoutCreateOptions represents the checkout options for creating a checkout.
Note: We use pointers for the boolean fields as otherwise, setting them to "false" would omit them, which would break some of the boolean checks in the API. See: https://docs.lemonsqueezy.com/api/checkouts#create-a-checkout
type CheckoutCreateProductOptions ¶ added in v1.1.0
type CheckoutCreateProductOptions struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Media []string `json:"media,omitempty"` RedirectURL string `json:"redirect_url,omitempty"` ReceiptButtonText string `json:"receipt_button_text,omitempty"` ReceiptLinkURL string `json:"receipt_link_url,omitempty"` ReceiptThankYouNote string `json:"receipt_thank_you_note,omitempty"` EnabledVariants []int `json:"enabled_variants,omitempty"` }
CheckoutCreateProductOptions represents product options for creating a checkout.
type CheckoutData ¶ added in v0.0.10
type CheckoutData struct { Email string `json:"email"` Name string `json:"name"` BillingAddress []BillingAddress `json:"billing_address"` TaxNumber string `json:"tax_number"` DiscountCode string `json:"discount_code"` Custom any `json:"custom"` }
CheckoutData contains information about a checkout
type CheckoutOptions ¶ added in v0.0.10
type CheckoutOptions struct { Embed bool `json:"embed"` Media bool `json:"media"` Logo bool `json:"logo"` Desc bool `json:"desc"` Discount bool `json:"discount"` Dark bool `json:"dark"` SubscriptionPreview bool `json:"subscription_preview"` ButtonColor string `json:"button_color"` }
CheckoutOptions are options for a checkout
type CheckoutPreview ¶ added in v0.0.10
type CheckoutPreview struct { Currency string `json:"currency"` CurrencyRate int `json:"currency_rate"` Subtotal int `json:"subtotal"` DiscountTotal int `json:"discount_total"` Tax int `json:"tax"` Total int `json:"total"` SubtotalUsd int `json:"subtotal_usd"` DiscountTotalUsd int `json:"discount_total_usd"` TaxUsd int `json:"tax_usd"` TotalUsd int `json:"total_usd"` SubtotalFormatted string `json:"subtotal_formatted"` DiscountTotalFormatted string `json:"discount_total_formatted"` TaxFormatted string `json:"tax_formatted"` TotalFormatted string `json:"total_formatted"` }
CheckoutPreview contains information about a percentage or amount discount that can be applied to an order at checkout via a code.
type CheckoutProductOptions ¶ added in v0.0.10
type CheckoutProductOptions struct { Name string `json:"name"` Description string `json:"description"` Media []any `json:"media"` RedirectURL string `json:"redirect_url"` ReceiptButtonText string `json:"receipt_button_text"` ReceiptLinkURL string `json:"receipt_link_url"` ReceiptThankYouNote string `json:"receipt_thank_you_note"` EnabledVariants []int `json:"enabled_variants"` }
CheckoutProductOptions are options for a checkout product
type CheckoutsAPIResponse ¶ added in v1.2.2
type CheckoutsAPIResponse = ApiResponseList[CheckoutAttributes, APIResponseRelationshipsDiscount]
CheckoutsAPIResponse is the api response for a list of checkout.
type CheckoutsService ¶ added in v0.0.10
type CheckoutsService service
CheckoutsService is the API client for the `/v1/checkouts` endpoint
func (*CheckoutsService) Create ¶ added in v0.0.10
func (service *CheckoutsService) Create(ctx context.Context, storeID int, variantID int, attributes *CheckoutCreateAttributes) (*CheckoutAPIResponse, *Response, error)
Create a custom checkout.
https://docs.lemonsqueezy.com/api/checkouts#create-a-checkout
func (*CheckoutsService) Get ¶ added in v0.0.10
func (service *CheckoutsService) Get(ctx context.Context, checkoutID string) (*CheckoutAPIResponse, *Response, error)
Get the checkout with the given ID.
https://docs.lemonsqueezy.com/api/checkouts#retrieve-a-checkout
func (*CheckoutsService) List ¶ added in v0.0.10
func (service *CheckoutsService) List(ctx context.Context) (*CheckoutsAPIResponse, *Response, error)
List returns a paginated list of checkouts.
https://docs.lemonsqueezy.com/api/checkouts#list-all-checkouts
type Client ¶
type Client struct { Webhooks *WebhooksService Subscriptions *SubscriptionsService Users *UsersService Stores *StoresService Customers *CustomersService Products *ProductsService Variants *VariantsService Files *FilesService Orders *OrdersService OrderItems *OrderItemsService SubscriptionInvoices *SubscriptionInvoicesService SubscriptionItems *SubscriptionItemsService DiscountRedemptions *DiscountRedemptionsService Discounts *DiscountsService Checkouts *CheckoutsService LicenseKeys *LicenseKeysService LicenseKeyInstances *LicenseKeyInstancesService Licenses *LicensesService Prices *PricesService // contains filtered or unexported fields }
Client is the lemonsqueezy API client. Do not instantiate this client with Client{}. Use the New method instead.
type CustomerApiResponse ¶ added in v0.0.5
type CustomerApiResponse = ApiResponse[CustomerAttributes, ApiResponseRelationshipsCustomer]
CustomerApiResponse represents a customer api response
type CustomerAttributes ¶ added in v0.0.5
type CustomerAttributes struct { StoreID int `json:"store_id"` Name string `json:"name"` Email string `json:"email"` Status string `json:"status"` City *string `json:"city"` Region *string `json:"region"` Country string `json:"country"` TotalRevenueCurrency int `json:"total_revenue_currency"` Mrr int `json:"mrr"` StatusFormatted string `json:"status_formatted"` CountryFormatted string `json:"country_formatted"` TotalRevenueCurrencyFormatted string `json:"total_revenue_currency_formatted"` MrrFormatted string `json:"mrr_formatted"` Urls struct { CustomerPortal string `json:"customer_portal"` } `json:"urls"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` }
CustomerAttributes are the attributes of a lemonsqueezy customer
type CustomersApiResponse ¶ added in v0.0.5
type CustomersApiResponse = ApiResponseList[CustomerAttributes, ApiResponseRelationshipsCustomer]
CustomersApiResponse represents a list of customers api responses.
type CustomersService ¶ added in v0.0.5
type CustomersService service
CustomersService is the API client for the `/v1/customers` endpoint
func (*CustomersService) Get ¶ added in v0.0.5
func (service *CustomersService) Get(ctx context.Context, customerID string) (*CustomerApiResponse, *Response, error)
Get returns the customer with the given ID.
https://docs.lemonsqueezy.com/api/customers#retrieve-a-customer
func (*CustomersService) List ¶ added in v0.0.5
func (service *CustomersService) List(ctx context.Context) (*CustomersApiResponse, *Response, error)
List returns a paginated list of customers.
https://docs.lemonsqueezy.com/api/customers#list-all-customers
type DiscountAPIResponse ¶ added in v1.2.2
type DiscountAPIResponse = ApiResponse[DiscountAttributes, APIResponseRelationshipsDiscount]
DiscountAPIResponse is the api response for one discount
type DiscountAttributes ¶ added in v0.0.9
type DiscountAttributes struct { StoreID int `json:"store_id"` Name string `json:"name"` Code string `json:"code"` Amount int `json:"amount"` AmountType string `json:"amount_type"` IsLimitedToProducts bool `json:"is_limited_to_products"` IsLimitedRedemptions bool `json:"is_limited_redemptions"` MaxRedemptions int `json:"max_redemptions"` StartsAt *time.Time `json:"starts_at"` ExpiresAt *time.Time `json:"expires_at"` Duration string `json:"duration"` DurationInMonths int `json:"duration_in_months"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
DiscountAttributes contains information about a percentage or amount discount that can be applied to an order at checkout via a code.
type DiscountCreateParams ¶ added in v0.0.9
type DiscountCreateParams struct { Name string `json:"name"` Code string `json:"code"` Amount int `json:"amount"` AmountType string `json:"amountType"` StoreID int `json:"storeID"` }
DiscountCreateParams are parameters for creating a discount
type DiscountRedemptionApiResponse ¶ added in v0.0.8
type DiscountRedemptionApiResponse = ApiResponse[DiscountRedemptionAttributes, ApiResponseRelationshipsDiscountRedemption]
DiscountRedemptionApiResponse is the api response for one discount redemption
type DiscountRedemptionAttributes ¶ added in v0.0.8
type DiscountRedemptionAttributes struct { DiscountID int `json:"discount_id"` OrderID int `json:"order_id"` DiscountName string `json:"discount_name"` DiscountCode string `json:"discount_code"` DiscountAmount int `json:"discount_amount"` DiscountAmountType string `json:"discount_amount_type"` Amount int `json:"amount"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
DiscountRedemptionAttributes is a record of a discount being applied to an order.
type DiscountRedemptionsApiResponse ¶ added in v0.0.8
type DiscountRedemptionsApiResponse = ApiResponseList[DiscountRedemptionAttributes, ApiResponseRelationshipsDiscountRedemption]
DiscountRedemptionsApiResponse is the api response for a list of discount redemptions.
type DiscountRedemptionsService ¶ added in v0.0.8
type DiscountRedemptionsService service
DiscountRedemptionsService is the API client for the `/v1/discount-redemptions` endpoint
func (*DiscountRedemptionsService) Get ¶ added in v0.0.8
func (service *DiscountRedemptionsService) Get(ctx context.Context, invoiceID string) (*DiscountRedemptionApiResponse, *Response, error)
Get returns the discount redemption with the given ID.
https://docs.lemonsqueezy.com/api/discount-redemptions#retrieve-a-discount-redemption
func (*DiscountRedemptionsService) List ¶ added in v0.0.8
func (service *DiscountRedemptionsService) List(ctx context.Context) (*DiscountRedemptionsApiResponse, *Response, error)
List a paginated list of discount redemptions.
https://docs.lemonsqueezy.com/api/discount-redemptions#list-all-discount-redemptions
type DiscountsAPIResponse ¶ added in v1.2.2
type DiscountsAPIResponse = ApiResponseList[DiscountAttributes, APIResponseRelationshipsDiscount]
DiscountsAPIResponse is the api response for a list of discounts.
type DiscountsService ¶ added in v0.0.9
type DiscountsService service
DiscountsService is the API client for the `/v1/discounts` endpoint
func (*DiscountsService) Create ¶ added in v0.0.9
func (service *DiscountsService) Create(ctx context.Context, params *DiscountCreateParams) (*DiscountAPIResponse, *Response, error)
Create a discount.
https://docs.lemonsqueezy.com/api/discounts#create-a-discount
func (*DiscountsService) Delete ¶ added in v0.0.9
Delete a discount with the given ID.
https://docs.lemonsqueezy.com/api/discounts#delete-a-discount
func (*DiscountsService) Get ¶ added in v0.0.9
func (service *DiscountsService) Get(ctx context.Context, discountID string) (*DiscountAPIResponse, *Response, error)
Get the discount with the given ID.
https://docs.lemonsqueezy.com/api/discounts#retrieve-a-discount
func (*DiscountsService) List ¶ added in v0.0.9
func (service *DiscountsService) List(ctx context.Context) (*DiscountsAPIResponse, *Response, error)
List returns a paginated list of discounts.
https://docs.lemonsqueezy.com/api/discounts#list-all-discounts
type FileApiResponse ¶ added in v0.0.6
type FileApiResponse = ApiResponse[FileAttributes, ApiResponseRelationshipsFile]
FileApiResponse is the api response for one file
type FileAttributes ¶ added in v0.0.6
type FileAttributes struct { VariantID int `json:"variant_id"` Identifier string `json:"identifier"` Name string `json:"name"` Extension string `json:"extension"` DownloadURL string `json:"download_url"` Size int `json:"size"` SizeFormatted string `json:"size_formatted"` Version string `json:"version"` Sort int `json:"sort"` Status string `json:"status"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
FileAttributes represents a digital good that can be downloaded by a customer after the product has been purchased.
type FilesApiResponse ¶ added in v0.0.6
type FilesApiResponse = ApiResponseList[FileAttributes, ApiResponseRelationshipsFile]
FilesApiResponse is the api response for a list of files.
type FilesService ¶ added in v0.0.6
type FilesService service
FilesService is the API client for the `/v1/files` endpoint
func (*FilesService) Get ¶ added in v0.0.6
func (service *FilesService) Get(ctx context.Context, fileID string) (*FileApiResponse, *Response, error)
Get returns the file with the given ID.
func (*FilesService) List ¶ added in v0.0.6
func (service *FilesService) List(ctx context.Context) (*FilesApiResponse, *Response, error)
List returns a paginated list of files.
type LicenseActivateApiResponse ¶ added in v1.0.5
type LicenseActivateApiResponse struct { Activated bool `json:"activated"` LicenseAttributes }
type LicenseAttributes ¶ added in v1.0.5
type LicenseAttributes struct { Error string `json:"error"` LicenseKey LicenseKey `json:"license_key"` Instance LicenseInstance `json:"instance"` Meta LicenseMeta `json:"meta"` }
type LicenseDeactivateApiResponse ¶ added in v1.0.5
type LicenseDeactivateApiResponse struct { Deactivated bool `json:"deactivated"` LicenseAttributes }
type LicenseInstance ¶ added in v1.0.5
type LicenseKey ¶ added in v1.0.5
type LicenseKey struct { ID int `json:"id"` Status string `json:"status"` Key string `json:"key"` ActivationLimit int `json:"activation_limit"` ActivationUsage int `json:"activation_usage"` CreatedAt time.Time `json:"created_at"` ExpiresAt *time.Time `json:"expires_at"` TestMode bool `json:"test_mode"` }
type LicenseKeyApiResponse ¶ added in v0.0.11
type LicenseKeyApiResponse = ApiResponse[LicenseKeyAttributes, ApiResponseRelationshipsLicenseKey]
LicenseKeyApiResponse is the api response for one subscription invoice
type LicenseKeyAttributes ¶ added in v0.0.11
type LicenseKeyAttributes struct { StoreID int `json:"store_id"` CustomerID int `json:"customer_id"` OrderID int `json:"order_id"` OrderItemID int `json:"order_item_id"` ProductID int `json:"product_id"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` Key string `json:"key"` KeyShort string `json:"key_short"` ActivationLimit int `json:"activation_limit"` InstancesCount int `json:"instances_count"` Disabled bool `json:"disabled"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` ExpiresAt interface{} `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
LicenseKeyAttributes contains information about a license key which can be used to externally verify that customer has access to a product.
type LicenseKeyInstanceApiResponse ¶ added in v0.0.11
type LicenseKeyInstanceApiResponse = ApiResponse[LicenseKeyInstanceAttributes, ApiResponseRelationshipsLicenseKeyInstance]
LicenseKeyInstanceApiResponse is the api response for one subscription invoice
type LicenseKeyInstanceAttributes ¶ added in v0.0.11
type LicenseKeyInstanceAttributes struct { LicenseKeyID int `json:"license_key_id"` Identifier string `json:"identifier"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
LicenseKeyInstanceAttributes represents a single instance (or activation) of a license key that has been issued to a customer.
type LicenseKeyInstancesApiResponse ¶ added in v0.0.11
type LicenseKeyInstancesApiResponse = ApiResponseList[LicenseKeyInstanceAttributes, ApiResponseRelationshipsLicenseKeyInstance]
LicenseKeyInstancesApiResponse is the api response for a list of subscription invoices.
type LicenseKeyInstancesService ¶ added in v0.0.11
type LicenseKeyInstancesService service
LicenseKeyInstancesService is the API client for the `/v1/license-key-instances` endpoint
func (*LicenseKeyInstancesService) Get ¶ added in v0.0.11
func (service *LicenseKeyInstancesService) Get(ctx context.Context, licenseKeyID string) (*LicenseKeyInstanceApiResponse, *Response, error)
Get retrieves the license key instance with the given ID.
https://docs.lemonsqueezy.com/api/license-key-instances#retrieve-a-license-key-instance
func (*LicenseKeyInstancesService) List ¶ added in v0.0.11
func (service *LicenseKeyInstancesService) List(ctx context.Context) (*LicenseKeyInstancesApiResponse, *Response, error)
List a paginated list of license key instances.
https://docs.lemonsqueezy.com/api/license-key-instances#list-all-license-key-instances
type LicenseKeysApiResponse ¶ added in v0.0.11
type LicenseKeysApiResponse = ApiResponseList[LicenseKeyAttributes, ApiResponseRelationshipsLicenseKey]
LicenseKeysApiResponse is the api response for a list of subscription invoices.
type LicenseKeysService ¶ added in v0.0.11
type LicenseKeysService service
LicenseKeysService is the API client for the `/v1/license-keys` endpoint
func (*LicenseKeysService) Get ¶ added in v0.0.11
func (service *LicenseKeysService) Get(ctx context.Context, licenseKeyID string) (*LicenseKeyApiResponse, *Response, error)
Get retrieves the license key with the given ID.
https://docs.lemonsqueezy.com/api/license-keys#retrieve-a-license-key
func (*LicenseKeysService) List ¶ added in v0.0.11
func (service *LicenseKeysService) List(ctx context.Context) (*LicenseKeysApiResponse, *Response, error)
List a paginated list of discount redemptions.
https://docs.lemonsqueezy.com/api/license-keys#list-all-license-keys
type LicenseMeta ¶ added in v1.0.5
type LicenseMeta struct { StoreID int `json:"store_id"` OrderID int `json:"order_id"` OrderItemID int `json:"order_item_id"` VariantID int `json:"variant_id"` VariantName string `json:"variant_name"` ProductID int `json:"product_id"` ProductName string `json:"product_name"` CustomerID int `json:"customer_id"` CustomerName string `json:"customer_name"` CustomerEmail string `json:"customer_email"` }
type LicenseValidateApiResponse ¶ added in v1.0.5
type LicenseValidateApiResponse struct { Valid bool `json:"valid"` LicenseAttributes }
type LicensesService ¶ added in v1.0.5
type LicensesService service
LicensesService is the API client for the `/v1/licenses` endpoint
func (*LicensesService) Activate ¶ added in v1.0.5
func (service *LicensesService) Activate(ctx context.Context, licenseKey, instanceName string) (*LicenseActivateApiResponse, *Response, error)
Activate a license key.
func (*LicensesService) Deactivate ¶ added in v1.0.5
func (service *LicensesService) Deactivate(ctx context.Context, licenseKey, instanceID string) (*LicenseDeactivateApiResponse, *Response, error)
Deactivate a license key.
func (*LicensesService) Validate ¶ added in v1.0.5
func (service *LicensesService) Validate(ctx context.Context, licenseKey, instanceID string) (*LicenseValidateApiResponse, *Response, error)
Validate a license key.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is options for constructing a client
func WithAPIKey ¶
WithAPIKey sets the lemonsqueezy API used to authenticate requests. https://docs.lemonsqueezy.com/api#authentication
func WithBaseURL ¶
WithBaseURL set's the base url for the flutterwave API
func WithHTTPClient ¶
WithHTTPClient sets the underlying HTTP client used for API requests. By default, http.DefaultClient is used.
func WithSigningSecret ¶
WithSigningSecret sets the lemonsqueezy webhook signing secret used to authenticate webhook requests. https://docs.lemonsqueezy.com/api/webhooks#webhook-requests
type OrderAPIResponse ¶ added in v1.2.0
type OrderAPIResponse = ApiResponse[OrderAttributes, APIResponseRelationshipsOrder]
OrderAPIResponse is the api response for one order
type OrderAttributes ¶ added in v0.0.7
type OrderAttributes struct { StoreID int `json:"store_id"` CustomerID int `json:"customer_id"` Identifier string `json:"identifier"` OrderNumber int `json:"order_number"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` Currency string `json:"currency"` CurrencyRate string `json:"currency_rate"` Subtotal int `json:"subtotal"` DiscountTotal int `json:"discount_total"` Tax int `json:"tax"` Total int `json:"total"` SubtotalUsd int `json:"subtotal_usd"` DiscountTotalUsd int `json:"discount_total_usd"` TaxUsd int `json:"tax_usd"` TotalUsd int `json:"total_usd"` TaxName string `json:"tax_name"` TaxRate any `json:"tax_rate"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` Refunded bool `json:"refunded"` RefundedAt *time.Time `json:"refunded_at"` SubtotalFormatted string `json:"subtotal_formatted"` DiscountTotalFormatted string `json:"discount_total_formatted"` TaxFormatted string `json:"tax_formatted"` TotalFormatted string `json:"total_formatted"` Urls struct { Receipt string `json:"receipt"` } `json:"urls"` FirstOrderItem struct { ID int `json:"id"` OrderID int `json:"order_id"` ProductID int `json:"product_id"` VariantID int `json:"variant_id"` ProductName string `json:"product_name"` VariantName string `json:"variant_name"` Price int `json:"price"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` } `json:"first_order_item"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
OrderAttributes for an order which is created when a customer purchases a product.
type OrderItemApiResponse ¶ added in v0.0.7
type OrderItemApiResponse = ApiResponse[OrderItemAttributes, ApiResponseRelationshipsOrderItem]
OrderItemApiResponse is the api response for one order item
type OrderItemAttributes ¶ added in v0.0.7
type OrderItemAttributes struct { OrderID int `json:"order_id"` ProductID int `json:"product_id"` VariantID int `json:"variant_id"` ProductName string `json:"product_name"` VariantName string `json:"variant_name"` Price int `json:"price"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
OrderItemAttributes is a line item for an order that includes product, variant and price information.
type OrderItemsApiResponse ¶ added in v0.0.7
type OrderItemsApiResponse = ApiResponseList[OrderItemAttributes, ApiResponseRelationshipsOrderItem]
OrderItemsApiResponse is the api response for a list of order items.
type OrderItemsService ¶ added in v0.0.7
type OrderItemsService service
OrderItemsService is the API client for the `/v1/order-items` endpoint
func (*OrderItemsService) Get ¶ added in v0.0.7
func (service *OrderItemsService) Get(ctx context.Context, orderItemID string) (*OrderItemApiResponse, *Response, error)
Get returns the order-item with the given ID.
https://docs.lemonsqueezy.com/api/order-items#retrieve-an-order-item
func (*OrderItemsService) List ¶ added in v0.0.7
func (service *OrderItemsService) List(ctx context.Context) (*OrderItemsApiResponse, *Response, error)
List returns a paginated list of order-items.
https://docs.lemonsqueezy.com/api/order-items#list-all-order-items
type OrdersAPIResponse ¶ added in v1.2.0
type OrdersAPIResponse = ApiResponseList[OrderAttributes, APIResponseRelationshipsOrder]
OrdersAPIResponse is the api response for a list of orders.
type OrdersService ¶ added in v0.0.7
type OrdersService service
OrdersService is the API client for the `/v1/orders` endpoint
func (*OrdersService) Get ¶ added in v0.0.7
func (service *OrdersService) Get(ctx context.Context, orderID string) (*OrderAPIResponse, *Response, error)
Get returns the order with the given ID.
func (*OrdersService) List ¶ added in v0.0.7
func (service *OrdersService) List(ctx context.Context) (*OrdersAPIResponse, *Response, error)
List returns a paginated list of orders.
type PriceAPIResponse ¶ added in v1.2.0
type PriceAPIResponse = ApiResponse[PriceAttributes, APIResponseRelationshipsPrice]
PriceAPIResponse is the api response for one variant
type PriceAttributes ¶ added in v1.2.0
type PriceAttributes struct { VariantID int `json:"variant_id"` Category string `json:"category"` Scheme string `json:"scheme"` UsageAggregation any `json:"usage_aggregation"` UnitPrice int `json:"unit_price"` UnitPriceDecimal any `json:"unit_price_decimal"` SetupFeeEnabled bool `json:"setup_fee_enabled"` SetupFee any `json:"setup_fee"` PackageSize int `json:"package_size"` Tiers []PriceAttributesTiers `json:"tiers"` RenewalIntervalUnit string `json:"renewal_interval_unit"` RenewalIntervalQuantity int `json:"renewal_interval_quantity"` TrialIntervalUnit string `json:"trial_interval_unit"` TrialIntervalQuantity int `json:"trial_interval_quantity"` MinPrice any `json:"min_price"` SuggestedPrice any `json:"suggested_price"` TaxCode string `json:"tax_code"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
PriceAttributes represents a price added to a variant.
type PriceAttributesTiers ¶ added in v1.2.0
type PriceAttributesTiers struct { LastUnit any `json:"last_unit"` UnitPrice int `json:"unit_price"` UnitPriceDecimal *string `json:"unit_price_decimal"` FixedFee int `json:"fixed_fee"` }
PriceAttributesTiers is list of pricing tier objects when using volume and graduated pricing.
type PricesAPIResponse ¶ added in v1.2.0
type PricesAPIResponse = ApiResponseList[PriceAttributes, APIResponseRelationshipsPrice]
PricesAPIResponse is the api response for a list of variants.
type PricesService ¶ added in v1.2.0
type PricesService service
PricesService is the API client for the `/v1/prices` endpoint
func (*PricesService) Get ¶ added in v1.2.0
func (service *PricesService) Get(ctx context.Context, priceID int) (*PriceAPIResponse, *Response, error)
Get returns the price with the given ID.
func (*PricesService) List ¶ added in v1.2.0
func (service *PricesService) List(ctx context.Context) (*PricesAPIResponse, *Response, error)
List returns a paginated list of prices.
type ProductApiResponse ¶ added in v0.0.5
type ProductApiResponse = ApiResponse[ProductAttributes, ApiResponseRelationshipsProduct]
ProductApiResponse represents a product api response
type ProductAttributes ¶ added in v0.0.5
type ProductAttributes struct { StoreID int `json:"store_id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` ThumbURL string `json:"thumb_url"` LargeThumbURL string `json:"large_thumb_url"` Price any `json:"price"` PayWhatYouWant bool `json:"pay_what_you_want"` FromPrice *int `json:"from_price"` FromPriceFormatted *string `json:"from_price_formatted"` ToPrice *int `json:"to_price"` ToPriceFormatted *string `json:"to_price_formatted"` BuyNowURL string `json:"buy_now_url"` PriceFormatted string `json:"price_formatted"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
ProductAttributes are the attributes of a lemonsqueezy product
type ProductsApiResponse ¶ added in v0.0.5
type ProductsApiResponse = ApiResponseList[ProductAttributes, ApiResponseRelationshipsProduct]
ProductsApiResponse represents a list of products api responses.
type ProductsService ¶ added in v0.0.5
type ProductsService service
ProductsService is the API client for the `/v1/products` endpoint
func (*ProductsService) Get ¶ added in v0.0.5
func (service *ProductsService) Get(ctx context.Context, productID string) (*ProductApiResponse, *Response, error)
Get returns the product with the given ID.
https://docs.lemonsqueezy.com/api/products#retrieve-a-product
func (*ProductsService) List ¶ added in v0.0.5
func (service *ProductsService) List(ctx context.Context) (*ProductsApiResponse, *Response, error)
List returns a paginated list of products.
https://docs.lemonsqueezy.com/api/products#list-all-products
type Resource ¶ added in v0.0.3
type Resource[T any] struct { Type string `json:"type"` ID string `json:"id"` Attributes T `json:"attributes"` }
Resource returns a lemonsqueezy resource. It's similar to ApiResponseData but without the links
type StoreApiResponse ¶ added in v0.0.4
type StoreApiResponse = ApiResponse[StoreAttributes, ApiResponseRelationshipsStore]
StoreApiResponse represents a store api response
type StoreAttributes ¶ added in v0.0.4
type StoreAttributes struct { Name string `json:"name"` Slug string `json:"slug"` Domain string `json:"domain"` Url string `json:"url"` AvatarUrl string `json:"avatar_url"` Plan string `json:"plan"` Country string `json:"country"` CountryNiceName string `json:"country_nicename"` Currency string `json:"currency"` TotalSales int `json:"total_sales"` TotalRevenue int `json:"total_revenue"` ThirtyDaySales int `json:"thirty_day_sales"` ThirtyDayRevenue int `json:"thirty_day_revenue"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
StoreAttributes Everything in Lemon Squeezy belongs to a store.
type StoresApiResponse ¶ added in v0.0.5
type StoresApiResponse = ApiResponseList[StoreAttributes, ApiResponseRelationshipsStore]
StoresApiResponse represents a list of store api responses.
type StoresService ¶ added in v0.0.4
type StoresService service
StoresService is the API client for the `/v1/stores` endpoint
func (*StoresService) Get ¶ added in v0.0.4
func (service *StoresService) Get(ctx context.Context, storeID int) (*StoreApiResponse, *Response, error)
Get returns the store with the given ID.
func (*StoresService) List ¶ added in v0.0.4
func (service *StoresService) List(ctx context.Context) (*StoresApiResponse, *Response, error)
List returns a paginated list of stores.
type Subscription ¶
type Subscription struct { StoreID int `json:"store_id"` SubscriptionID int `json:"subscription_id"` CustomerID int `json:"customer_id"` OrderID int `json:"order_id"` OrderItemID int `json:"order_item_id"` ProductID int `json:"product_id"` VariantID int `json:"variant_id"` ProductName string `json:"product_name"` VariantName string `json:"variant_name"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` CardBrand string `json:"card_brand"` CardLastFour string `json:"card_last_four"` Pause *SubscriptionPause `json:"pause"` Cancelled bool `json:"cancelled"` TrialEndsAt *time.Time `json:"trial_ends_at"` BillingAnchor int `json:"billing_anchor"` FirstSubscriptionItem *SubscriptionFirstSubscriptionItem `json:"first_subscription_item"` Urls SubscriptionURLs `json:"urls"` RenewsAt time.Time `json:"renews_at"` EndsAt *time.Time `json:"ends_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` }
Subscription is created when a subscription product is purchased and will bill the customer on a recurring basis. https://docs.lemonsqueezy.com/api/subscriptions#the-subscription-object
type SubscriptionApiResponse ¶ added in v1.0.4
type SubscriptionApiResponse = ApiResponse[Subscription, ApiResponseRelationshipsSubscription]
SubscriptionApiResponse represents a subscription api response
type SubscriptionFirstSubscriptionItem ¶ added in v1.0.4
type SubscriptionFirstSubscriptionItem struct { ID int `json:"id"` SubscriptionItem }
SubscriptionSubscriptionItem is an object representing the first subscription item belonging to this subscription.
type SubscriptionInvoiceApiResponse ¶ added in v0.0.8
type SubscriptionInvoiceApiResponse = ApiResponse[SubscriptionInvoiceAttributes, ApiResponseRelationshipsSubscriptionInvoice]
SubscriptionInvoiceApiResponse is the api response for one subscription invoice
type SubscriptionInvoiceAttributes ¶ added in v0.0.8
type SubscriptionInvoiceAttributes struct { StoreID int `json:"store_id"` SubscriptionID int `json:"subscription_id"` BillingReason string `json:"billing_reason"` CardBrand string `json:"card_brand"` CardLastFour string `json:"card_last_four"` Currency string `json:"currency"` CurrencyRate string `json:"currency_rate"` Subtotal int `json:"subtotal"` DiscountTotal int `json:"discount_total"` Tax int `json:"tax"` Total int `json:"total"` SubtotalUsd int `json:"subtotal_usd"` DiscountTotalUsd int `json:"discount_total_usd"` TaxUsd int `json:"tax_usd"` TotalUsd int `json:"total_usd"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` Refunded bool `json:"refunded"` RefundedAt *time.Time `json:"refunded_at"` SubtotalFormatted string `json:"subtotal_formatted"` DiscountTotalFormatted string `json:"discount_total_formatted"` TaxFormatted string `json:"tax_formatted"` TotalFormatted string `json:"total_formatted"` Urls struct { InvoiceURL string `json:"invoice_url"` } `json:"urls"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` }
SubscriptionInvoiceAttributes is the invoice for a subscription https://docs.lemonsqueezy.com/api/subscription-invoices#the-subscription-invoice-object
type SubscriptionInvoicesApiResponse ¶ added in v0.0.8
type SubscriptionInvoicesApiResponse = ApiResponseList[SubscriptionInvoiceAttributes, ApiResponseRelationshipsSubscriptionInvoice]
SubscriptionInvoicesApiResponse is the api response for a list of subscription invoices.
type SubscriptionInvoicesService ¶ added in v0.0.8
type SubscriptionInvoicesService service
SubscriptionInvoicesService is the API client for the `/v1/subscription-invoices` endpoint
func (*SubscriptionInvoicesService) Get ¶ added in v0.0.8
func (service *SubscriptionInvoicesService) Get(ctx context.Context, invoiceID string) (*SubscriptionInvoiceApiResponse, *Response, error)
Get returns the subscription invoice with the given ID.
https://docs.lemonsqueezy.com/api/subscription-invoices#retrieve-a-subscription-invoice
func (*SubscriptionInvoicesService) List ¶ added in v0.0.8
func (service *SubscriptionInvoicesService) List(ctx context.Context) (*SubscriptionInvoicesApiResponse, *Response, error)
List a paginated list of subscription invoices.
https://docs.lemonsqueezy.com/api/subscription-invoices#list-all-subscription-invoices
type SubscriptionItem ¶ added in v1.0.3
type SubscriptionItem struct { SubscriptionID int `json:"subscription_id"` PriceID int `json:"price_id"` Quantity int `json:"quantity"` IsUsageBased bool `json:"is_usage_based"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
In Lemon Squeezy A subscription item is an object that links a price to a subscription and also contains quantity information. https://docs.lemonsqueezy.com/api/subscription-items#the-subscription-item-object
type SubscriptionItemApiResponse ¶ added in v1.0.3
type SubscriptionItemApiResponse = ApiResponse[SubscriptionItem, ApiResponseRelationshipsSubscriptionItem]
SubscriptionItemApiResponse represents a subscription item api response
type SubscriptionItemCurrentUsageApiResponse ¶ added in v1.0.4
type SubscriptionItemCurrentUsageApiResponse struct { Jsonapi ApiResponseJSONAPI `json:"jsonapi"` Meta ApiResponseMetaSubscriptionItemCurrentUsage `json:"meta"` }
SubscriptionItemsCurrentUsageApiResponse represents the subscription item's current usage api response
type SubscriptionItemListParams ¶ added in v1.0.4
SubscriptionItemListParams are parameters for filtering list responses
type SubscriptionItemUpdateParams ¶ added in v1.0.3
type SubscriptionItemUpdateParams struct { ID string `json:"id"` Attributes SubscriptionItemUpdateParamsAttributes `json:"attributes"` }
SubscriptionUpdateParams are parameters for updating a subscription
type SubscriptionItemUpdateParamsAttributes ¶ added in v1.0.3
type SubscriptionItemUpdateParamsAttributes struct {
Quantity int `json:"quantity,omitempty"`
}
SubscriptionUpdateParamsAttributes are subscription update attributes
type SubscriptionItemsApiResponse ¶ added in v1.0.3
type SubscriptionItemsApiResponse = ApiResponseList[SubscriptionItem, ApiResponseRelationshipsSubscriptionItem]
SubscriptionItemsApiResponse represents a list of subscription items api responses
type SubscriptionItemsService ¶ added in v1.0.4
type SubscriptionItemsService service
SubscriptionItemsService is the API client for the `/subscription-items` endpoint
func (*SubscriptionItemsService) CurrentUsage ¶ added in v1.0.4
func (service *SubscriptionItemsService) CurrentUsage(ctx context.Context, subscriptionItemID string) (*SubscriptionItemCurrentUsageApiResponse, *Response, error)
Current usage returns a subscription item's current usage with the given ID.
https://docs.lemonsqueezy.com/api/subscription-items#retrieve-a-subscription-item-s-current-usage
func (*SubscriptionItemsService) Get ¶ added in v1.0.4
func (service *SubscriptionItemsService) Get(ctx context.Context, subscriptionItemID string) (*SubscriptionItemApiResponse, *Response, error)
Get returns the subscription item with the given ID.
https://docs.lemonsqueezy.com/api/subscription-items#retrieve-a-subscription-item
func (*SubscriptionItemsService) List ¶ added in v1.0.4
func (service *SubscriptionItemsService) List(ctx context.Context, queryParams map[string]string) (*SubscriptionItemsApiResponse, *Response, error)
List returns a paginated list of subscription items you can add extra query params to your request
https://docs.lemonsqueezy.com/api/subscriptions#list-all-subscriptions
func (*SubscriptionItemsService) Update ¶ added in v1.0.4
func (service *SubscriptionItemsService) Update(ctx context.Context, params *SubscriptionItemUpdateParams) (*SubscriptionItemApiResponse, *Response, error)
Update a subscription item
https://docs.lemonsqueezy.com/api/subscription-items#update-a-subscription-item
type SubscriptionPause ¶
SubscriptionPause is object of customer-facing URLs for managing the subscription.
type SubscriptionURLs ¶
type SubscriptionURLs struct { UpdatePaymentMethod string `json:"update_payment_method"` CustomerPortal string `json:"customer_portal"` }
SubscriptionURLs is object of customer-facing URLs for managing the subscription.
type SubscriptionUpdateParams ¶ added in v0.0.3
type SubscriptionUpdateParams struct { ID string `json:"id"` Attributes SubscriptionUpdateParamsAttributes `json:"attributes"` }
SubscriptionUpdateParams are parameters for updating a subscription
type SubscriptionUpdateParamsAttributes ¶ added in v0.0.3
type SubscriptionUpdateParamsAttributes struct { ProductID int `json:"product_id,omitempty"` VariantID int `json:"variant_id,omitempty"` BillingAnchor int `json:"billing_anchor,omitempty"` Cancelled bool `json:"cancelled"` Pause *SubscriptionPause `json:"pause,omitempty"` InvoiceImmediately bool `json:"invoice_immediately"` DisableProrations bool `json:"disable_prorations"` }
SubscriptionUpdateParamsAttributes are subscription update attributes
type SubscriptionsApiResponse ¶ added in v1.0.4
type SubscriptionsApiResponse = ApiResponseList[Subscription, ApiResponseRelationshipsSubscription]
SubscriptionsApiResponse represents a list of subscription api responses.
type SubscriptionsService ¶ added in v0.0.3
type SubscriptionsService service
SubscriptionsService is the API client for the `/subscriptions` endpoint
func (*SubscriptionsService) Cancel ¶ added in v0.0.3
func (service *SubscriptionsService) Cancel(ctx context.Context, subscriptionID string) (*SubscriptionApiResponse, *Response, error)
Cancel an active subscription the given ID.
https://docs.lemonsqueezy.com/api/subscriptions#retrieve-a-subscription
func (*SubscriptionsService) Get ¶ added in v0.0.3
func (service *SubscriptionsService) Get(ctx context.Context, subscriptionID string) (*SubscriptionApiResponse, *Response, error)
Get returns the subscription with the given ID.
https://docs.lemonsqueezy.com/api/subscriptions#retrieve-a-subscription
func (*SubscriptionsService) List ¶ added in v0.0.3
func (service *SubscriptionsService) List(ctx context.Context) (*SubscriptionsApiResponse, *Response, error)
List returns a paginated list of subscriptions ordered by created_at (descending)
https://docs.lemonsqueezy.com/api/subscriptions#list-all-subscriptions
func (*SubscriptionsService) Update ¶ added in v0.0.3
func (service *SubscriptionsService) Update(ctx context.Context, params *SubscriptionUpdateParams) (*SubscriptionApiResponse, *Response, error)
Update an existing subscription to specific parameter
https://docs.lemonsqueezy.com/api/subscriptions#update-a-subscription
type UserApiResponse ¶ added in v0.0.4
type UserApiResponse = ApiResponseWithoutRelationships[UserAttributes]
UserApiResponse represents a UserAttributes api response
type UserAttributes ¶ added in v0.0.4
type UserAttributes struct { Name string `json:"name"` Email string `json:"email"` Color string `json:"color"` AvatarURL string `json:"avatar_url"` HasCustomAvatar bool `json:"has_custom_avatar"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
UserAttributes represents your personal user account that you use to log in to Lemon Squeezy.
type UsersService ¶ added in v0.0.4
type UsersService service
UsersService is the API client for the `/v1/users` endpoint
func (*UsersService) Me ¶ added in v0.0.4
func (service *UsersService) Me(ctx context.Context) (*UserApiResponse, *Response, error)
Me retrieves the currently authenticated user. https://docs.lemonsqueezy.com/api/users#retrieve-the-authenticated-user
type VariantAPIResponse ¶ added in v1.2.0
type VariantAPIResponse = ApiResponse[VariantAttributes, APIResponseRelationshipsVariant]
VariantAPIResponse is the api response for one variant
type VariantAttributes ¶ added in v0.0.6
type VariantAttributes struct { ProductID int `json:"product_id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Price any `json:"price"` IsSubscription bool `json:"is_subscription"` Interval *string `json:"interval"` IntervalCount *int `json:"interval_count"` HasFreeTrial bool `json:"has_free_trial"` TrialInterval string `json:"trial_interval"` TrialIntervalCount int `json:"trial_interval_count"` PayWhatYouWant bool `json:"pay_what_you_want"` MinPrice int `json:"min_price"` SuggestedPrice int `json:"suggested_price"` HasLicenseKeys bool `json:"has_license_keys"` LicenseActivationLimit int `json:"license_activation_limit"` IsLicenseLimitUnlimited bool `json:"is_license_limit_unlimited"` LicenseLengthValue int `json:"license_length_value"` LicenseLengthUnit string `json:"license_length_unit"` IsLicenseLengthUnlimited bool `json:"is_license_length_unlimited"` Sort int `json:"sort"` Status string `json:"status"` StatusFormatted string `json:"status_formatted"` TestMode bool `json:"test_mode"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
VariantAttributes represents a different option that is presented to the customer at checkout.
type VariantsAPIResponse ¶ added in v1.2.0
type VariantsAPIResponse = ApiResponseList[VariantAttributes, APIResponseRelationshipsVariant]
VariantsAPIResponse is the api response for a list of variants.
type VariantsService ¶ added in v0.0.6
type VariantsService service
VariantsService is the API client for the `/v1/variants` endpoint
func (*VariantsService) Get ¶ added in v0.0.6
func (service *VariantsService) Get(ctx context.Context, variantID int) (*VariantAPIResponse, *Response, error)
Get returns the variant with the given ID.
https://docs.lemonsqueezy.com/api/variants#retrieve-a-variant
func (*VariantsService) List ¶ added in v0.0.6
func (service *VariantsService) List(ctx context.Context) (*VariantsAPIResponse, *Response, error)
List returns a paginated list of variants.
https://docs.lemonsqueezy.com/api/variants#list-all-variants
type WebhookApiResponse ¶ added in v0.0.12
type WebhookApiResponse = ApiResponse[WebhookAttributes, ApiResponseRelationshipWebhook]
WebhookApiResponse is the api response for one webhook
type WebhookAttributes ¶ added in v0.0.12
type WebhookAttributes struct { StoreID int `json:"store_id"` URL string `json:"url"` Events []string `json:"events"` LastSentAt *time.Time `json:"last_sent_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` TestMode bool `json:"test_mode"` }
WebhookAttributes contains information about a webhook.
type WebhookCreateParams ¶ added in v0.0.12
type WebhookCreateParams struct { URL string `json:"url"` Events []string `json:"events"` Secret string `json:"secret"` }
WebhookCreateParams are parameters for creating a webhook
type WebhookRequest ¶
type WebhookRequest[T, R any] struct { Meta WebhookRequestMeta `json:"meta"` Data WebhookRequestData[T, R] `json:"data"` }
WebhookRequest represents a webhook request
type WebhookRequestData ¶
type WebhookRequestData[Attributes, Relationships any] struct { Type string `json:"type"` ID string `json:"id"` Attributes Attributes `json:"attributes"` Relationships Relationships `json:"relationships"` Links ApiResponseSelfLink `json:"links"` }
WebhookRequestData webhook request data
type WebhookRequestLicenseKey ¶ added in v0.0.12
type WebhookRequestLicenseKey WebhookRequest[LicenseKeyAttributes, ApiResponseRelationshipsLicenseKey]
WebhookRequestLicenseKey is the payload for license key related events e.g. license_key_created
type WebhookRequestMeta ¶
type WebhookRequestMeta struct { EventName string `json:"event_name"` TestMode bool `json:"test_mode"` CustomData map[string]any `json:"custom_data"` }
WebhookRequestMeta contains meta data about the request
type WebhookRequestOrder ¶ added in v0.0.12
type WebhookRequestOrder WebhookRequest[OrderAttributes, APIResponseRelationshipsOrder]
WebhookRequestOrder is the payload for order related events e.g. order_created, order_refunded
type WebhookRequestSubscription ¶ added in v0.0.12
type WebhookRequestSubscription WebhookRequest[Subscription, ApiResponseRelationshipsSubscription]
WebhookRequestSubscription is the payload for subscription related events e.g. subscription_created, subscription_updated
type WebhookRequestSubscriptionInvoice ¶ added in v0.0.12
type WebhookRequestSubscriptionInvoice WebhookRequest[SubscriptionInvoiceAttributes, ApiResponseRelationshipsSubscriptionInvoice]
WebhookRequestSubscriptionInvoice is the payload for subscription invoice related events e.g. subscription_payment_success, subscription_payment_failed
type WebhookUpdateParams ¶ added in v0.0.12
type WebhookUpdateParams struct { ID string `json:"id"` Secret string `json:"secret"` Events []string `json:"events"` }
WebhookUpdateParams are parameters for updating a webhook
type WebhooksApiResponse ¶ added in v0.0.12
type WebhooksApiResponse = ApiResponseList[WebhookAttributes, ApiResponseRelationshipWebhook]
WebhooksApiResponse is the api response for a list of webhooks.
type WebhooksService ¶ added in v0.0.3
type WebhooksService service
WebhooksService is the used to verify the signature in webhook requests
func (*WebhooksService) Create ¶ added in v0.0.12
func (service *WebhooksService) Create(ctx context.Context, storeId int, params *WebhookCreateParams) (*WebhookApiResponse, *Response, error)
Create a webhook.
func (*WebhooksService) Get ¶ added in v0.0.12
func (service *WebhooksService) Get(ctx context.Context, webhookID string) (*WebhookApiResponse, *Response, error)
Get the webhook with the given ID.
https://docs.lemonsqueezy.com/api/webhooks#retrieve-a-webhook
func (*WebhooksService) List ¶ added in v0.0.12
func (service *WebhooksService) List(ctx context.Context) (*WebhooksApiResponse, *Response, error)
List returns a paginated list of webhooks.
https://docs.lemonsqueezy.com/api/webhooks#list-all-webhooks
func (*WebhooksService) Update ¶ added in v0.0.12
func (service *WebhooksService) Update(ctx context.Context, params *WebhookUpdateParams) (*WebhookApiResponse, *Response, error)
Update an existing webhook
https://docs.lemonsqueezy.com/api/subscriptions#update-a-webhook
Source Files ¶
- checkout.go
- checkouts_service.go
- client.go
- client_config.go
- client_option.go
- contracts.go
- customer.go
- customers_service.go
- discount.go
- discount_redemption.go
- discount_redemption_service.go
- discounts_service.go
- file.go
- files_service.go
- license_key.go
- license_key_instance.go
- license_key_instance_service.go
- license_key_service.go
- licenses.go
- licenses_service.go
- order.go
- order_item.go
- order_items_service.go
- orders_service.go
- price.go
- prices_service.go
- product.go
- products_service.go
- response.go
- store.go
- stores_service.go
- subscription_invoice.go
- subscription_invoice_service.go
- subscription_items.go
- subscription_items_service.go
- subscriptions.go
- subscriptions_service.go
- user.go
- users_service.go
- variant.go
- variants_service.go
- webhook.go
- webhook_event.go
- webhook_request.go
- webhooks_service.go