Documentation
¶
Index ¶
- func NewValidationError(field, message string) error
- func ValidateAddress(address Address) error
- func ValidateAddressCountry(country string) bool
- type ActivateDraftSubscriptionRequest
- type AddAddonRequest
- type AddAddonToSubscriptionRequest
- type AddonAssociationResponse
- type AddonResponse
- type Address
- type AggregatedEntitlement
- type AggregatedFeature
- type AlertConfig
- type AlertLogResponse
- type AssignTenantRequest
- type AuthResponse
- type BillingCycleInfo
- type BillingPeriodInfo
- type BulkIngestEventRequest
- type CalculateROIRequest
- type CancelFutureSubscriptionGrantsRequest
- type CancelScheduleRequest
- type CancelScheduleResponse
- type CancelSubscriptionRequest
- type CancelSubscriptionResponse
- type CardDetails
- type ChargeSavedPaymentMethodRequest
- type CompleteOAuthRequest
- type CompleteOAuthResponse
- type ConnectionResponse
- type CostAnalyticItem
- type CostBreakdownItem
- type CostBreakdownResponse
- type CostBreakup
- type CostPeriod
- type CostPoint
- type CostSheetResponse
- type CostsheetResponse
- type CouponApplicationResponse
- type CouponAssociationResponse
- type CouponResponse
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateAddonRequest
- type CreateAddonResponse
- type CreateBulkEntitlementRequest
- type CreateBulkEntitlementResponse
- type CreateBulkPriceRequest
- type CreateBulkPriceResponse
- type CreateConnectionRequest
- type CreateCostSheetRequest
- type CreateCostsheetRequest
- type CreateCostsheetResponse
- type CreateCouponApplicationRequest
- type CreateCouponAssociationRequest
- type CreateCouponRequest
- type CreateCreditGrantApplicationRequest
- type CreateCreditGrantRequest
- type CreateCreditNoteLineItemRequest
- type CreateCreditNoteRequest
- type CreateCustomerRequest
- type CreateEntitlementRequest
- type CreateEntityIntegrationMappingRequest
- type CreateEnvironmentRequest
- type CreateFeatureRequest
- type CreateGroupRequest
- type CreateIntegrationRequest
- type CreateInvoiceLineItemRequest
- type CreateInvoiceRequest
- type CreateMeterRequest
- type CreatePaymentLinkRequest
- type CreatePaymentRequest
- type CreatePlanEntitlementRequest
- type CreatePlanPriceRequest
- type CreatePlanRequest
- type CreatePlanResponse
- type CreatePriceRequest
- type CreatePriceTier
- type CreatePriceUnitRequest
- type CreatePriceUnitResponse
- type CreateProrationInvoiceRequest
- type CreateScheduledTaskRequest
- type CreateSettingRequest
- type CreateSetupIntentRequest
- type CreateStripePaymentLinkRequest
- type CreateSubscriptionInvoiceRequest
- type CreateSubscriptionLineItemRequest
- type CreateSubscriptionPhaseRequest
- type CreateSubscriptionRequest
- type CreateTaskRequest
- type CreateTaxAppliedRequest
- type CreateTaxAssociationRequest
- type CreateTaxRateRequest
- type CreateTenantRequest
- type CreateUserRequest
- type CreateWalletRequest
- type CreditGrantApplicationResponse
- type CreditGrantResponse
- type CreditNoteResponse
- type CurrencyRevenueWindows
- type CustomerEntitlementsResponse
- type CustomerInvoiceSummary
- type CustomerMultiCurrencyInvoiceSummary
- type CustomerResponse
- type CustomerUsageSummaryResponse
- type DashboardRevenuesRequest
- type DashboardRevenuesResponse
- type DeleteCostsheetResponse
- type DeletePriceRequest
- type DeleteSubscriptionLineItemRequest
- type DiscountResult
- type EntitlementResponse
- type EntitlementSource
- type EntitlementSourceEntityType
- type EntityIntegrationMappingResponse
- type EnvironmentResponse
- type Event
- type EventCostInfo
- type EventCountPoint
- type ExpiredCreditsResponse
- type ExpiredCreditsResponseItem
- type ExportRequest
- type ExportResponse
- type FeatureResponse
- type FeatureUsageSummary
- type GatewayInfo
- type GenericPaymentStatusResponse
- type GetActiveAddonAssociationRequest
- type GetCostAnalyticsRequest
- type GetCostAnalyticsResponse
- type GetCostBreakdownRequest
- type GetCostsheetResponse
- type GetCustomerEntitlementsRequest
- type GetCustomerPaymentMethodsRequest
- type GetCustomerUsageSummaryRequest
- type GetCustomerWalletsRequest
- type GetDefaultPaymentMethodRequest
- type GetDetailedCostAnalyticsResponse
- type GetEventsRequest
- type GetEventsResponse
- type GetHuggingFaceBillingDataRequest
- type GetHuggingFaceBillingDataResponse
- type GetInvoiceWithBreakdownRequest
- type GetMonitoringDataRequest
- type GetMonitoringDataResponse
- type GetPendingSchedulesResponse
- type GetPreviewInvoiceRequest
- type GetPricesByPlanRequest
- type GetSubscriptionEntitlementsRequest
- type GetSupportedGatewaysResponse
- type GetUnpaidInvoicesToBePaidRequest
- type GetUnpaidInvoicesToBePaidResponse
- type GetUpcomingCreditGrantApplicationsRequest
- type GetUsageAnalyticsRequest
- type GetUsageAnalyticsResponse
- type GetUsageByMeterRequest
- type GetUsageBySubscriptionRequest
- type GetUsageBySubscriptionResponse
- type GetUsageRequest
- type GetUsageResponse
- type GroupResponse
- type IngestEventRequest
- type InitiateOAuthRequest
- type InitiateOAuthResponse
- type IntegrationEntityMapping
- type InvoiceCoupon
- type InvoiceLineItemCoupon
- type InvoiceLineItemPreview
- type InvoiceLineItemResponse
- type InvoicePaymentStatusResponse
- type InvoicePreview
- type InvoiceResponse
- func (r *InvoiceResponse) WithCouponApplications(couponApplications []*CouponApplicationResponse) *InvoiceResponse
- func (r *InvoiceResponse) WithCustomer(customer *CustomerResponse) *InvoiceResponse
- func (r *InvoiceResponse) WithSubscription(sub *SubscriptionResponse) *InvoiceResponse
- func (r *InvoiceResponse) WithTaxes(taxes []*TaxAppliedResponse) *InvoiceResponse
- func (r *InvoiceResponse) WithUsageAnalytics(usageAnalytics map[string][]SourceUsageItem) *InvoiceResponse
- func (r *InvoiceResponse) WithUsageBreakdown(usageBreakdown map[string][]UsageBreakdownItem) *InvoiceResponse
- type InvoiceVoidRequest
- type LineItemCommitmentConfig
- type LineItemParams
- type LinkTaxRateToEntityRequest
- type LinkedIntegrationsResponse
- type ListAddonAssociationsResponse
- type ListAddonsResponse
- type ListAlertLogsResponse
- type ListConnectionsResponse
- type ListCostSheetsResponse
- type ListCostsheetResponse
- type ListCouponApplicationsResponse
- type ListCouponAssociationsResponse
- type ListCouponsResponse
- type ListCreditGrantApplicationsResponse
- type ListCreditGrantsResponse
- type ListCreditNotesResponse
- type ListCustomersResponse
- type ListEntitlementsResponse
- type ListEntityIntegrationMappingsResponse
- type ListEnvironmentsResponse
- type ListFeaturesResponse
- type ListGroupsResponse
- type ListInvoicesResponse
- type ListMetersResponse
- type ListPaymentMethodsRequest
- type ListPaymentsResponse
- type ListPlansResponse
- type ListPriceUnitsResponse
- type ListPricesResponse
- type ListScheduledTasksResponse
- type ListSecretsResponse
- type ListSetupIntentsRequest
- type ListSetupIntentsResponse
- type ListSubscriptionPausesResponse
- type ListSubscriptionPhasesResponse
- type ListSubscriptionsResponse
- type ListTasksResponse
- type ListTaxAppliedResponse
- type ListTaxAssociationsResponse
- type ListTaxRatesResponse
- type ListUsersResponse
- type ListWalletTransactionsResponse
- type LoginRequest
- type ManualBalanceDebitRequest
- type MeterResponse
- type MultiProviderPaymentMethodsResponse
- type OnboardingEventsRequest
- type OnboardingEventsResponse
- type OverrideEntitlementRequest
- type OverrideLineItemRequest
- type PauseSubscriptionRequest
- type PauseSubscriptionResponse
- type PaymentAttemptResponse
- type PaymentIntentResponse
- type PaymentLinkResponse
- type PaymentMethodResponse
- type PaymentParameters
- type PaymentResponse
- type PaymentStatusRequest
- type PaymentStatusResponse
- type Period
- type PlanResponse
- type PlanSummary
- type PortalAnalyticsRequest
- type PortalCostAnalyticsRequest
- type PortalPaginatedRequest
- type PortalSessionResponse
- type PriceResponse
- type PriceUnitConfig
- type PriceUnitResponse
- type ProcessScheduledCreditGrantApplicationsResponse
- type ProrationDetail
- type ProrationDetails
- type ProrationLineItem
- type ProrationLineItemResult
- type ProrationResult
- type ROIResponse
- type RecentSubscriptionsResponse
- type RemoveAddonRequest
- type ResumeSubscriptionRequest
- type ResumeSubscriptionResponse
- type RevenueTrendRequest
- type RevenueTrendResponse
- type ScheduledTaskResponse
- type SecretResponse
- type SetDefaultPaymentMethodRequest
- type SettingResponse
- type SetupIntentListItem
- type SetupIntentResponse
- type SignUpRequest
- type SourceUsageItem
- type StripeInvoiceSyncRequest
- type StripeInvoiceSyncResponse
- type StripePaymentLinkResponse
- type SubscriptionChangeExecuteResponse
- type SubscriptionChangePreviewResponse
- type SubscriptionChangeRequest
- type SubscriptionCouponRequest
- type SubscriptionEntitlementsResponse
- type SubscriptionLineItemRequest
- type SubscriptionLineItemResponse
- type SubscriptionPauseResponse
- type SubscriptionPhaseCreateRequest
- type SubscriptionPhaseResponse
- type SubscriptionResponse
- type SubscriptionResponseV2
- type SubscriptionScheduleResponse
- type SubscriptionSummary
- type SubscriptionSyncParams
- type SubscriptionSyncResult
- type SubscriptionUpdatePeriodResponse
- type SubscriptionUpdatePeriodResponseItem
- type SubscriptionUsageByMetersResponse
- type SuccessResponse
- type SyncPlanPricesResponse
- type SynchronizationSummary
- type TaskResponse
- type TaxAppliedResponse
- type TaxAssociationResponse
- type TaxAssociationUpdateRequest
- type TaxRateOverride
- type TaxRateResponse
- type TenantBillingDetails
- type TenantBillingUsage
- type TenantResponse
- type Threshold
- type TopUpWalletRequest
- type TopUpWalletResponse
- type TriggerForceRunRequest
- type TriggerForceRunResponse
- type UpdateAddonRequest
- type UpdateConnectionRequest
- type UpdateCostSheetRequest
- type UpdateCostsheetRequest
- type UpdateCostsheetResponse
- type UpdateCouponRequest
- type UpdateCreditGrantRequest
- type UpdateCustomerRequest
- type UpdateEntitlementRequest
- type UpdateEntityIntegrationMappingRequest
- type UpdateEnvironmentRequest
- type UpdateFeatureRequest
- type UpdateInvoicePaymentRequest
- type UpdateInvoiceRequest
- type UpdateMeterRequest
- type UpdatePaymentRequest
- type UpdatePaymentStatusRequest
- type UpdatePlanRequest
- type UpdatePriceRequest
- type UpdatePriceUnitRequest
- type UpdateScheduledTaskRequest
- type UpdateSettingRequest
- type UpdateSubscriptionLineItemRequest
- func (r *UpdateSubscriptionLineItemRequest) HasCommitment() bool
- func (r *UpdateSubscriptionLineItemRequest) ShouldCreateNewLineItem() bool
- func (r *UpdateSubscriptionLineItemRequest) ToSubscriptionLineItem(ctx context.Context, existingLineItem *subscription.SubscriptionLineItem, ...) *subscription.SubscriptionLineItem
- func (r *UpdateSubscriptionLineItemRequest) Validate() error
- type UpdateSubscriptionPhaseRequest
- type UpdateSubscriptionRequest
- type UpdateTaskStatusRequest
- type UpdateTaxRateRequest
- type UpdateTenantRequest
- type UpdateWalletRequest
- type UsageAnalyticItem
- type UsageAnalyticPoint
- type UsageBreakdownItem
- type UsageResult
- type UserResponse
- type ValidationError
- type VoidOldPendingInvoicesResponse
- type VoidOldPendingInvoicesResponseItem
- type WalletBalanceResponse
- type WalletResponse
- type WalletTransactionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewValidationError ¶ added in v1.0.21
NewValidationError creates a new validation error
func ValidateAddress ¶ added in v1.0.0
ValidateAddress validates all address fields
func ValidateAddressCountry ¶ added in v1.0.0
ValidateAddressCountry validates the country code format
Types ¶
type ActivateDraftSubscriptionRequest ¶ added in v1.0.42
type ActivateDraftSubscriptionRequest struct {
// start_date is the new start date for the subscription when activating
StartDate *time.Time `json:"start_date" validate:"required"`
}
ActivateDraftSubscriptionRequest represents the request to activate a draft subscription
func (*ActivateDraftSubscriptionRequest) Validate ¶ added in v1.0.42
func (r *ActivateDraftSubscriptionRequest) Validate() error
Validate validates the activation request
type AddAddonRequest ¶ added in v1.0.21
type AddAddonRequest struct {
SubscriptionID string `json:"subscription_id" validate:"required"`
AddAddonToSubscriptionRequest `json:",inline"`
}
AddAddonRequest is used by body-based endpoint /subscriptions/addon
type AddAddonToSubscriptionRequest ¶ added in v1.0.21
type AddAddonToSubscriptionRequest struct {
AddonID string `json:"addon_id" validate:"required"`
StartDate *time.Time `json:"start_date,omitempty"`
Metadata map[string]interface{} `json:"metadata"`
// LineItemCommitments allows setting commitment configuration per addon line item (keyed by price_id)
LineItemCommitments map[string]*LineItemCommitmentConfig `json:"line_item_commitments,omitempty" validate:"omitempty,dive"`
// SkipEntityValidation is used to skip the entitlement check for the addon
// This is used to add an addon to a subscription without checking the entitlement compatibility
// This is used when we are adding an addon to a subscription that already has an active instance of the addon
// In that case we don't need to check the entitlement compatibility
SkipEntityValidation bool `json:"-"`
}
AddAddonToSubscriptionRequest represents the request to add an addon to a subscription
func (*AddAddonToSubscriptionRequest) ToAddonAssociation ¶ added in v1.0.21
func (a *AddAddonToSubscriptionRequest) ToAddonAssociation(ctx context.Context, enitiyId string, enitityType types.AddonAssociationEntityType) *addonassociation.AddonAssociation
func (*AddAddonToSubscriptionRequest) Validate ¶ added in v1.0.21
func (r *AddAddonToSubscriptionRequest) Validate() error
type AddonAssociationResponse ¶ added in v1.0.21
type AddonAssociationResponse struct {
*addonassociation.AddonAssociation
Addon *AddonResponse `json:"addon,omitempty"`
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
}
AddonAssociationResponse represents the response for an addon association
type AddonResponse ¶ added in v1.0.21
type AddonResponse struct {
*addon.Addon
// Optional expanded fields
Prices []*PriceResponse `json:"prices,omitempty"`
Entitlements []*EntitlementResponse `json:"entitlements,omitempty"`
}
AddonResponse represents the addon response
type Address ¶ added in v1.0.0
type Address struct {
Line1 string `json:"address_line1" validate:"omitempty,max=255"`
Line2 string `json:"address_line2" validate:"omitempty,max=255"`
City string `json:"address_city" validate:"omitempty,max=100"`
State string `json:"address_state" validate:"omitempty,max=100"`
PostalCode string `json:"address_postal_code" validate:"omitempty,max=20"`
Country string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
}
Address represents a physical address
type AggregatedEntitlement ¶ added in v1.0.0
type AggregatedEntitlement struct {
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit,omitempty"`
IsSoftLimit bool `json:"is_soft_limit"`
UsageResetPeriod types.EntitlementUsageResetPeriod `json:"usage_reset_period,omitempty"`
StaticValues []string `json:"static_values,omitempty"` // For static/SLA features
}
AggregatedEntitlement contains the final calculated entitlement values
type AggregatedFeature ¶ added in v1.0.0
type AggregatedFeature struct {
Feature *FeatureResponse `json:"feature"`
Entitlement *AggregatedEntitlement `json:"entitlement"`
Sources []*EntitlementSource `json:"sources"`
}
AggregatedFeature represents a feature with its aggregated entitlements
type AlertConfig ¶ added in v1.0.21
type AlertConfig struct {
Threshold *Threshold `json:"threshold,omitempty"`
}
type AlertLogResponse ¶ added in v1.0.35
type AlertLogResponse struct {
ID string `json:"id"`
EntityType types.AlertEntityType `json:"entity_type"`
EntityID string `json:"entity_id"`
ParentEntityType *string `json:"parent_entity_type,omitempty"`
ParentEntityID *string `json:"parent_entity_id,omitempty"`
CustomerID *string `json:"customer_id,omitempty"`
AlertType types.AlertType `json:"alert_type"`
AlertStatus types.AlertState `json:"alert_status"`
AlertInfo types.AlertInfo `json:"alert_info"`
EnvironmentID string `json:"environment_id"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
// Expanded fields
Customer *CustomerResponse `json:"customer,omitempty"`
Wallet *WalletResponse `json:"wallet,omitempty"`
Feature *FeatureResponse `json:"feature,omitempty"`
}
AlertLogResponse represents the alert log response
func ToAlertLogResponse ¶ added in v1.0.35
func ToAlertLogResponse(alertLog *alertlogs.AlertLog) *AlertLogResponse
ToAlertLogResponse converts domain alert log to DTO
type AssignTenantRequest ¶
type AuthResponse ¶
type BillingCycleInfo ¶ added in v1.0.25
type BillingCycleInfo struct {
// period_start is the start of the new billing period
PeriodStart time.Time `json:"period_start"`
// period_end is the end of the new billing period
PeriodEnd time.Time `json:"period_end"`
// billing_anchor is the new billing anchor
BillingAnchor time.Time `json:"billing_anchor"`
// billing_cadence is the billing cadence
BillingCadence types.BillingCadence `json:"billing_cadence"`
// billing_period is the billing period
BillingPeriod types.BillingPeriod `json:"billing_period"`
// billing_period_count is the billing period count
BillingPeriodCount int `json:"billing_period_count" default:"1"`
}
BillingCycleInfo contains information about billing cycle
type BillingPeriodInfo ¶ added in v1.0.0
type BillingPeriodInfo struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Period string `json:"period"` // e.g., "monthly", "yearly"
}
BillingPeriodInfo represents information about a billing period
type BulkIngestEventRequest ¶ added in v1.0.0
type BulkIngestEventRequest struct {
Events []*IngestEventRequest `json:"events" validate:"required,min=1,max=1000"`
}
func (*BulkIngestEventRequest) Validate ¶ added in v1.0.0
func (r *BulkIngestEventRequest) Validate() error
type CalculateROIRequest ¶ added in v1.0.18
type CalculateROIRequest struct {
// SubscriptionID is required to get subscription details
SubscriptionID string `json:"subscription_id" validate:"required"`
// MeterID references the meter to track usage
MeterID string `json:"meter_id,omitempty"`
// PriceID references the price configuration
PriceID string `json:"price_id,omitempty"`
// Optional time range. If not provided, uses entire subscription period
PeriodStart *time.Time `json:"period_start,omitempty"`
PeriodEnd *time.Time `json:"period_end,omitempty"`
}
CalculateROIRequest represents the request to calculate ROI for a cost sheet
type CancelFutureSubscriptionGrantsRequest ¶ added in v1.0.59
type CancelFutureSubscriptionGrantsRequest struct {
SubscriptionID string `json:"subscription_id" binding:"required"`
EffectiveDate *time.Time `json:"effective_date,omitempty"`
}
CancelFutureSubscriptionGrantsRequest represents the request to cancel future credit grants for a subscription
func (*CancelFutureSubscriptionGrantsRequest) Validate ¶ added in v1.0.59
func (r *CancelFutureSubscriptionGrantsRequest) Validate() error
Validate validates the cancel future subscription grants request
type CancelScheduleRequest ¶ added in v1.0.60
type CancelScheduleRequest struct {
// schedule_id is the ID of the schedule to cancel (optional if subscription_id and schedule_type are provided)
ScheduleID *string `json:"schedule_id,omitempty"`
// subscription_id is the ID of the subscription (required if schedule_id is not provided)
SubscriptionID *string `json:"subscription_id,omitempty"`
// schedule_type is the type of schedule to cancel (required if schedule_id is not provided)
ScheduleType *types.SubscriptionScheduleChangeType `json:"schedule_type,omitempty"`
}
CancelScheduleRequest represents the request to cancel a schedule @Description Request to cancel a subscription schedule (supports two modes)
func (*CancelScheduleRequest) Validate ¶ added in v1.0.60
func (r *CancelScheduleRequest) Validate() error
Validate validates the cancel schedule request
type CancelScheduleResponse ¶ added in v1.0.60
type CancelScheduleResponse struct {
// status is the new status (should be "cancelled")
Status types.ScheduleStatus `json:"status"`
// message is a confirmation message
Message string `json:"message"`
}
CancelScheduleResponse represents the response after cancelling a schedule @Description Confirmation of schedule cancellation
type CancelSubscriptionRequest ¶ added in v1.0.25
type CancelSubscriptionRequest struct {
// ProrationBehavior controls how proration is handled.
ProrationBehavior types.ProrationBehavior `json:"proration_behavior,omitempty"`
// CancellationType determines when the cancellation takes effect
CancellationType types.CancellationType `json:"cancellation_type" validate:"required"`
// Reason for cancellation (for audit and business intelligence)
Reason string `json:"reason,omitempty"`
//SuppressWebhook is an internal flag to suppress webhook events during cancellation.
SuppressWebhook bool `json:"-,omitempty"`
}
CancelSubscriptionRequest represents the enhanced cancellation request
func (*CancelSubscriptionRequest) Validate ¶ added in v1.0.25
func (r *CancelSubscriptionRequest) Validate() error
Validate validates the cancellation request
type CancelSubscriptionResponse ¶ added in v1.0.25
type CancelSubscriptionResponse struct {
// Basic cancellation info
SubscriptionID string `json:"subscription_id"`
CancellationType types.CancellationType `json:"cancellation_type"`
EffectiveDate time.Time `json:"effective_date"`
Status types.SubscriptionStatus `json:"status"`
Reason string `json:"reason,omitempty"`
// Proration details
ProrationInvoice *InvoiceResponse `json:"proration_invoice,omitempty"`
ProrationDetails []ProrationDetail `json:"proration_details"`
TotalCreditAmount decimal.Decimal `json:"total_credit_amount" swaggertype:"string"`
// Response metadata
Message string `json:"message"`
ProcessedAt time.Time `json:"processed_at"`
}
CancelSubscriptionResponse represents the enhanced cancellation response
type CardDetails ¶ added in v1.0.22
type CardDetails struct {
Brand string `json:"brand"`
Last4 string `json:"last4"`
ExpMonth int `json:"exp_month"`
ExpYear int `json:"exp_year"`
Fingerprint string `json:"fingerprint"`
}
CardDetails represents card details in a payment method
type ChargeSavedPaymentMethodRequest ¶ added in v1.0.22
type ChargeSavedPaymentMethodRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
PaymentMethodID string `json:"payment_method_id" binding:"required"`
Amount decimal.Decimal `json:"amount" binding:"required"`
Currency string `json:"currency" binding:"required"`
InvoiceID string `json:"invoice_id,omitempty"`
PaymentID string `json:"payment_id,omitempty"`
}
ChargeSavedPaymentMethodRequest represents a request to charge a saved payment method
type CompleteOAuthRequest ¶ added in v1.0.47
type CompleteOAuthRequest struct {
Provider types.OAuthProvider `json:"provider" binding:"required"` // e.g., "quickbooks"
SessionID string `json:"session_id" binding:"required"` // Session ID from initiate OAuth
Code string `json:"code" binding:"required"` // OAuth authorization code from the provider
State string `json:"state" binding:"required"` // CSRF state token
RealmID string `json:"realm_id"` // QuickBooks realm ID (required for QuickBooks, validated in Validate())
}
CompleteOAuthRequest represents a generic request to complete OAuth for any provider
func (*CompleteOAuthRequest) Validate ¶ added in v1.0.47
func (r *CompleteOAuthRequest) Validate() error
Validate validates the OAuth complete request with provider-specific rules
type CompleteOAuthResponse ¶ added in v1.0.47
type CompleteOAuthResponse struct {
Success bool `json:"success"`
ConnectionID string `json:"connection_id"`
}
CompleteOAuthResponse represents the response from completing OAuth
type ConnectionResponse ¶ added in v1.0.21
type ConnectionResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ProviderType types.SecretProvider `json:"provider_type"`
EnvironmentID string `json:"environment_id"`
TenantID string `json:"tenant_id"`
Status types.Status `json:"status"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
SyncConfig *types.SyncConfig `json:"sync_config,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
ConnectionResponse represents the response for connection operations
func ToConnectionResponse ¶ added in v1.0.21
func ToConnectionResponse(conn *connection.Connection) *ConnectionResponse
ToConnectionResponse converts domain Connection to ConnectionResponse
func ToConnectionResponses ¶ added in v1.0.21
func ToConnectionResponses(connections []*connection.Connection) []ConnectionResponse
ToConnectionResponses converts multiple domain Connections to ConnectionResponses
type CostAnalyticItem ¶ added in v1.0.33
type CostAnalyticItem struct {
MeterID string `json:"meter_id"`
MeterName string `json:"meter_name,omitempty"`
Source string `json:"source,omitempty"`
CustomerID string `json:"customer_id,omitempty"`
ExternalCustomerID string `json:"external_customer_id,omitempty"`
Properties map[string]string `json:"properties,omitempty"`
// Aggregated metrics
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
TotalQuantity decimal.Decimal `json:"total_quantity" swaggertype:"string"`
TotalEvents int64 `json:"total_events"`
// Breakdown
CostByPeriod []CostPoint `json:"cost_by_period,omitempty"` // Time-series
// Metadata
Currency string `json:"currency"`
PriceID string `json:"price_id,omitempty"`
CostsheetID string `json:"costsheet_id,omitempty"`
// Expanded data (populated when expand options are specified)
Meter *meter.Meter `json:"meter,omitempty"`
Price *price.Price `json:"price,omitempty"`
}
CostAnalyticItem represents a single cost analytics item
type CostBreakdownItem ¶ added in v1.0.18
type CostBreakdownItem struct {
// MeterID identifies the meter
MeterID string `json:"meter_id"`
// MeterName is the display name of the meter
MeterName string `json:"meter_name"`
// Cost is the calculated cost for this meter
Cost decimal.Decimal `json:"cost" swaggertype:"string"`
// Usage is the total usage for this meter in the period
Usage decimal.Decimal `json:"usage" swaggertype:"string"`
// Unit is the unit of measurement
Unit string `json:"unit"`
}
CostBreakdownItem represents the cost for a single meter.
type CostBreakdownResponse ¶ added in v1.0.18
type CostBreakdownResponse struct {
// TotalCost is the sum of all meter costs
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
// Items contains the breakdown by meter
Items []CostBreakdownItem `json:"items"`
// Period shows the time range for this calculation
Period CostPeriod `json:"period"`
}
CostBreakdownResponse represents the calculated costs for a period.
type CostBreakup ¶ added in v1.0.17
type CostBreakup struct {
// EffectiveUnitCost is the per-unit cost based on the applicable tier
EffectiveUnitCost decimal.Decimal
// SelectedTierIndex is the index of the tier that was applied (-1 if no tiers)
SelectedTierIndex int
// TierUnitAmount is the unit amount of the selected tier
TierUnitAmount decimal.Decimal
// FinalCost is the total cost for the quantity
FinalCost decimal.Decimal
}
CostBreakup provides detailed information about cost calculation including which tier was applied and the effective per unit cost
type CostPeriod ¶ added in v1.0.33
type CostPeriod struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
CostPeriod represents a time period for cost calculations.
type CostPoint ¶ added in v1.0.33
type CostPoint struct {
Timestamp time.Time `json:"timestamp"`
Cost decimal.Decimal `json:"cost" swaggertype:"string"`
Quantity decimal.Decimal `json:"quantity" swaggertype:"string"`
EventCount int64 `json:"event_count"`
}
CostPoint represents a single point in cost time-series data
type CostSheetResponse ¶ added in v1.0.18
type CostSheetResponse struct {
ID string `json:"id"`
MeterID string `json:"meter_id"`
PriceID string `json:"price_id"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
}
CostSheetResponse represents a legacy costsheet response (deprecated)
type CostsheetResponse ¶ added in v1.0.33
type CostsheetResponse struct {
ID string `json:"id"`
Name string `json:"name"`
LookupKey string `json:"lookup_key,omitempty"`
Description string `json:"description,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
Status types.Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
Prices []*PriceResponse `json:"prices,omitempty"` // Associated prices
}
CostsheetResponse represents a costsheet in API responses
func ToCostsheetResponse ¶ added in v1.0.33
func ToCostsheetResponse(costsheet *costsheet.Costsheet) *CostsheetResponse
ToCostsheetResponse converts a domain model to response DTO
func ToCostsheetResponseWithPrices ¶ added in v1.0.33
func ToCostsheetResponseWithPrices(costsheet *costsheet.Costsheet, prices []*PriceResponse) *CostsheetResponse
ToCostsheetResponseWithPrices converts a domain model to response DTO with prices
func (*CostsheetResponse) ToCostsheet ¶ added in v1.0.33
func (r *CostsheetResponse) ToCostsheet() *costsheet.Costsheet
ToCostsheet converts response DTO to domain model
type CouponApplicationResponse ¶ added in v1.0.21
type CouponApplicationResponse struct {
*coupon_application.CouponApplication `json:",inline"`
}
CouponApplicationResponse represents the response for coupon application data
type CouponAssociationResponse ¶ added in v1.0.21
type CouponAssociationResponse struct {
*couponAssociation.CouponAssociation `json:",inline"`
}
CouponAssociationResponse represents the response for coupon association data
type CouponResponse ¶ added in v1.0.21
CouponResponse represents the response for coupon data
func NewCouponResponse ¶ added in v1.0.38
func NewCouponResponse(c *coupon.Coupon) *CouponResponse
NewCouponResponse creates a new coupon response from a domain coupon
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Name string `json:"name" binding:"required" validate:"required"`
Type types.SecretType `json:"type" binding:"required" validate:"required"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
ServiceAccountID string `json:"service_account_id,omitempty"`
}
CreateAPIKeyRequest represents the request to create a new API key
func (*CreateAPIKeyRequest) Validate ¶
func (r *CreateAPIKeyRequest) Validate() error
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct {
Secret SecretResponse `json:"secret"`
APIKey string `json:"api_key,omitempty"`
}
CreateAPIKeyResponse represents the response when creating a new API key
type CreateAddonRequest ¶ added in v1.0.21
type CreateAddonRequest struct {
Name string `json:"name" validate:"required"`
LookupKey string `json:"lookup_key" validate:"required"`
Description string `json:"description"`
Type types.AddonType `json:"type" validate:"required"`
Metadata map[string]interface{} `json:"metadata"`
}
CreateAddonRequest represents the request to create an addon
func (*CreateAddonRequest) ToAddon ¶ added in v1.0.21
func (r *CreateAddonRequest) ToAddon(ctx context.Context) *addon.Addon
func (*CreateAddonRequest) Validate ¶ added in v1.0.21
func (r *CreateAddonRequest) Validate() error
type CreateAddonResponse ¶ added in v1.0.21
type CreateAddonResponse struct {
*AddonResponse
}
CreateAddonResponse represents the response after creating an addon
type CreateBulkEntitlementRequest ¶ added in v1.0.21
type CreateBulkEntitlementRequest struct {
Items []CreateEntitlementRequest `json:"items" validate:"required,min=1,max=100"`
}
CreateBulkEntitlementRequest represents the request to create multiple entitlements in bulk
func (*CreateBulkEntitlementRequest) Validate ¶ added in v1.0.21
func (r *CreateBulkEntitlementRequest) Validate() error
Validate validates the bulk entitlement creation request
type CreateBulkEntitlementResponse ¶ added in v1.0.21
type CreateBulkEntitlementResponse struct {
Items []*EntitlementResponse `json:"items"`
}
CreateBulkEntitlementResponse represents the response for bulk entitlement creation
type CreateBulkPriceRequest ¶ added in v1.0.21
type CreateBulkPriceRequest struct {
Items []CreatePriceRequest `json:"items" validate:"required,min=1,max=100"`
}
CreateBulkPriceRequest represents the request to create multiple prices in bulk
func (*CreateBulkPriceRequest) Validate ¶ added in v1.0.21
func (r *CreateBulkPriceRequest) Validate() error
Validate validates the bulk price creation request
type CreateBulkPriceResponse ¶ added in v1.0.21
type CreateBulkPriceResponse struct {
Items []*PriceResponse `json:"items"`
}
CreateBulkPriceResponse represents the response for bulk price creation
type CreateConnectionRequest ¶ added in v1.0.21
type CreateConnectionRequest struct {
Name string `json:"name" validate:"required,max=255"`
ProviderType types.SecretProvider `json:"provider_type" validate:"required"`
EncryptedSecretData types.ConnectionMetadata `json:"encrypted_secret_data,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
SyncConfig *types.SyncConfig `json:"sync_config,omitempty" validate:"omitempty,dive"`
}
CreateConnectionRequest represents the request to create a connection
func (*CreateConnectionRequest) ToConnection ¶ added in v1.0.21
func (req *CreateConnectionRequest) ToConnection() *connection.Connection
ToConnection converts CreateConnectionRequest to domain Connection
func (*CreateConnectionRequest) UnmarshalJSON ¶ added in v1.0.21
func (req *CreateConnectionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshaling to handle flat metadata structure
type CreateCostSheetRequest ¶ added in v1.0.18
type CreateCostSheetRequest struct {
// MeterID references the meter to track usage
MeterID string `json:"meter_id" validate:"required"`
// PriceID references the price configuration
PriceID string `json:"price_id" validate:"required"`
}
CreateCostSheetRequest represents the legacy request to create a costsheet (deprecated)
type CreateCostsheetRequest ¶ added in v1.0.33
type CreateCostsheetRequest struct {
Name string `json:"name" validate:"required,min=1,max=255"`
LookupKey string `json:"lookup_key,omitempty" validate:"omitempty,min=1,max=255"`
Description string `json:"description,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
CreateCostsheetRequest represents the request to create a new costsheet
func (*CreateCostsheetRequest) ToCostsheet ¶ added in v1.0.33
func (r *CreateCostsheetRequest) ToCostsheet(ctx context.Context) *costsheet.Costsheet
ToCostsheet converts the request to a domain model
func (*CreateCostsheetRequest) Validate ¶ added in v1.0.33
func (r *CreateCostsheetRequest) Validate() error
Validate validates the create costsheet request
type CreateCostsheetResponse ¶ added in v1.0.33
type CreateCostsheetResponse struct {
Costsheet *CostsheetResponse `json:"costsheet"`
}
CreateCostsheetResponse represents the response for creating a costsheet
type CreateCouponApplicationRequest ¶ added in v1.0.21
type CreateCouponApplicationRequest struct {
CouponID string `json:"coupon_id" validate:"required"`
CouponAssociationID string `json:"coupon_association_id,omitempty"`
InvoiceID string `json:"invoice_id" validate:"required"`
InvoiceLineItemID *string `json:"invoice_line_item_id,omitempty"`
SubscriptionID *string `json:"subscription_id,omitempty"`
OriginalPrice decimal.Decimal `json:"original_price" validate:"required" swaggertype:"string"`
FinalPrice decimal.Decimal `json:"final_price" validate:"required" swaggertype:"string"`
DiscountedAmount decimal.Decimal `json:"discounted_amount" validate:"required" swaggertype:"string"`
DiscountType types.CouponType `json:"discount_type" validate:"required"`
DiscountPercentage *decimal.Decimal `json:"discount_percentage,omitempty" swaggertype:"string"`
Currency string `json:"currency" validate:"required"`
CouponSnapshot map[string]interface{} `json:"coupon_snapshot,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
CreateCouponApplicationRequest represents the request to create a new coupon application
func (*CreateCouponApplicationRequest) Validate ¶ added in v1.0.21
func (r *CreateCouponApplicationRequest) Validate() error
Validate validates the CreateCouponApplicationRequest
type CreateCouponAssociationRequest ¶ added in v1.0.21
type CreateCouponAssociationRequest struct {
CouponID string `json:"coupon_id" validate:"required"`
SubscriptionID string `json:"subscription_id" validate:"required"`
SubscriptionLineItemID *string `json:"subscription_line_item_id,omitempty"`
SubscriptionPhaseID *string `json:"subscription_phase_id,omitempty"`
StartDate time.Time `json:"start_date" validate:"required"`
EndDate *time.Time `json:"end_date,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
CreateCouponAssociationRequest represents the request to create a new coupon association
func (*CreateCouponAssociationRequest) Validate ¶ added in v1.0.21
func (r *CreateCouponAssociationRequest) Validate() error
Validate validates the CreateCouponAssociationRequest
type CreateCouponRequest ¶ added in v1.0.21
type CreateCouponRequest struct {
Name string `json:"name" validate:"required"`
RedeemAfter *time.Time `json:"redeem_after,omitempty"`
RedeemBefore *time.Time `json:"redeem_before,omitempty"`
MaxRedemptions *int `json:"max_redemptions,omitempty"`
Rules *map[string]interface{} `json:"rules,omitempty"`
AmountOff *decimal.Decimal `json:"amount_off,omitempty" swaggertype:"string"`
PercentageOff *decimal.Decimal `json:"percentage_off,omitempty" swaggertype:"string"`
Type types.CouponType `json:"type" validate:"required,oneof=fixed percentage"`
Cadence types.CouponCadence `json:"cadence" validate:"required,oneof=once repeated forever"`
DurationInPeriods *int `json:"duration_in_periods,omitempty"`
Metadata *map[string]string `json:"metadata,omitempty"`
Currency *string `json:"currency,omitempty"`
}
CreateCouponRequest represents the request to create a new coupon
func (*CreateCouponRequest) ToCoupon ¶ added in v1.0.38
func (r *CreateCouponRequest) ToCoupon(ctx context.Context) *coupon.Coupon
ToCoupon converts the request to a domain coupon
func (*CreateCouponRequest) Validate ¶ added in v1.0.21
func (r *CreateCouponRequest) Validate() error
Validate validates the CreateCouponRequest
type CreateCreditGrantApplicationRequest ¶ added in v1.0.49
type CreateCreditGrantApplicationRequest struct {
CreditGrantID string `json:"credit_grant_id" binding:"required"`
SubscriptionID string `json:"subscription_id"`
ScheduledFor time.Time `json:"scheduled_for" binding:"required"`
PeriodStart time.Time `json:"period_start" binding:"required"`
PeriodEnd *time.Time `json:"period_end"`
Credits decimal.Decimal `json:"credits" swaggertype:"string" binding:"required"`
ApplicationReason types.CreditGrantApplicationReason `json:"application_reason"`
SubscriptionStatusAtApplication types.SubscriptionStatus `json:"subscription_status_at_application"`
IdempotencyKey string `json:"idempotency_key"`
}
CreateCreditGrantApplicationRequest represents the request to create a new credit grant application
func (*CreateCreditGrantApplicationRequest) ToCreditGrantApplication ¶ added in v1.0.49
func (r *CreateCreditGrantApplicationRequest) ToCreditGrantApplication(ctx context.Context) *domainCreditGrantApplication.CreditGrantApplication
ToCreditGrantApplication converts CreateCreditGrantApplicationRequest to domain CreditGrantApplication
func (*CreateCreditGrantApplicationRequest) Validate ¶ added in v1.0.49
func (r *CreateCreditGrantApplicationRequest) Validate() error
Validate validates the create credit grant application request
type CreateCreditGrantRequest ¶ added in v1.0.18
type CreateCreditGrantRequest struct {
Name string `json:"name" binding:"required"`
Scope types.CreditGrantScope `json:"scope" binding:"required"`
PlanID *string `json:"plan_id,omitempty"`
SubscriptionID *string `json:"subscription_id,omitempty"`
Credits decimal.Decimal `json:"credits" binding:"required" swaggertype:"string"`
Cadence types.CreditGrantCadence `json:"cadence" binding:"required"`
Period *types.CreditGrantPeriod `json:"period,omitempty"`
PeriodCount *int `json:"period_count,omitempty"`
ExpirationType types.CreditGrantExpiryType `json:"expiration_type,omitempty"`
ExpirationDuration *int `json:"expiration_duration,omitempty"`
ExpirationDurationUnit *types.CreditGrantExpiryDurationUnit `json:"expiration_duration_unit,omitempty"`
Priority *int `json:"priority,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
CreditGrantAnchor *time.Time `json:"-"`
StartDate *time.Time `json:"-"`
EndDate *time.Time `json:"-"`
// amount in the currency = number of credits * conversion_rate
// ex if conversion_rate is 1, then 1 USD = 1 credit
// ex if conversion_rate is 2, then 1 USD = 0.5 credits
// ex if conversion_rate is 0.5, then 1 USD = 2 credits
ConversionRate *decimal.Decimal `json:"conversion_rate,omitempty" swaggertype:"string"`
// topup_conversion_rate is the conversion rate for the topup to the currency
// ex if topup_conversion_rate is 1, then 1 USD = 1 credit
// ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits
// ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
TopupConversionRate *decimal.Decimal `json:"topup_conversion_rate,omitempty" swaggertype:"string"`
}
CreateCreditGrantRequest represents the request to create a new credit grant
func (*CreateCreditGrantRequest) ToCreditGrant ¶ added in v1.0.18
func (r *CreateCreditGrantRequest) ToCreditGrant(ctx context.Context) *creditgrant.CreditGrant
ToCreditGrant converts CreateCreditGrantRequest to domain CreditGrant
func (*CreateCreditGrantRequest) Validate ¶ added in v1.0.18
func (r *CreateCreditGrantRequest) Validate() error
Validate validates the create credit grant request
type CreateCreditNoteLineItemRequest ¶ added in v1.0.18
type CreateCreditNoteLineItemRequest struct {
// invoice_line_item_id is the unique identifier of the invoice line item being credited
InvoiceLineItemID string `json:"invoice_line_item_id" validate:"required"`
// display_name is an optional human-readable name for this credit note line item
DisplayName string `json:"display_name" validate:"omitempty"`
// amount is the monetary amount to be credited for this line item
Amount decimal.Decimal `json:"amount" validate:"required" swaggertype:"string"`
// metadata contains additional custom key-value pairs for storing extra information about this line item
Metadata types.Metadata `json:"metadata" validate:"omitempty"`
}
CreateCreditNoteLineItemRequest represents a single line item in a credit note creation request
func (*CreateCreditNoteLineItemRequest) ToCreditNoteLineItem ¶ added in v1.0.18
func (r *CreateCreditNoteLineItemRequest) ToCreditNoteLineItem(ctx context.Context, cn *creditnote.CreditNote) *creditnote.CreditNoteLineItem
func (*CreateCreditNoteLineItemRequest) Validate ¶ added in v1.0.18
func (r *CreateCreditNoteLineItemRequest) Validate() error
type CreateCreditNoteRequest ¶ added in v1.0.18
type CreateCreditNoteRequest struct {
// credit_note_number is an optional human-readable identifier for the credit note
CreditNoteNumber string `json:"credit_note_number" validate:"omitempty"`
// invoice_id is the unique identifier of the invoice this credit note is applied to
InvoiceID string `json:"invoice_id" validate:"required"`
// memo is an optional free-text field for additional notes about the credit note
Memo string `json:"memo" validate:"omitempty"`
// reason specifies the reason for creating this credit note (duplicate, fraudulent, order_change, product_unsatisfactory)
Reason types.CreditNoteReason `json:"reason" validate:"required"`
// metadata contains additional custom key-value pairs for storing extra information
Metadata types.Metadata `json:"metadata" validate:"omitempty"`
// line_items contains the individual line items that make up this credit note (minimum 1 required)
LineItems []CreateCreditNoteLineItemRequest `json:"line_items"`
// idempotency_key is an optional key used to prevent duplicate credit note creation
IdempotencyKey *string `json:"idempotency_key" validate:"omitempty"`
// process_credit_note is a flag to process the credit note after creation
ProcessCreditNote bool `json:"process_credit_note" validate:"omitempty" default:"true"`
}
CreateCreditNoteRequest represents the request payload for creating a new credit note
func (*CreateCreditNoteRequest) ToCreditNote ¶ added in v1.0.18
func (r *CreateCreditNoteRequest) ToCreditNote(ctx context.Context, inv *invoice.Invoice) *creditnote.CreditNote
func (*CreateCreditNoteRequest) Validate ¶ added in v1.0.18
func (r *CreateCreditNoteRequest) Validate() error
type CreateCustomerRequest ¶
type CreateCustomerRequest struct {
// external_id is the unique identifier from your system to reference this customer (required)
ExternalID string `json:"external_id" validate:"required"`
// name is the full name or company name of the customer
Name string `json:"name"`
// email is the customer's email address and must be a valid email format if provided
Email string `json:"email" validate:"omitempty,email"`
// address_line1 is the primary address line with maximum 255 characters
AddressLine1 string `json:"address_line1" validate:"omitempty,max=255"`
// address_line2 is the secondary address line with maximum 255 characters
AddressLine2 string `json:"address_line2" validate:"omitempty,max=255"`
// address_city is the city name with maximum 100 characters
AddressCity string `json:"address_city" validate:"omitempty,max=100"`
// address_state is the state, province, or region name with maximum 100 characters
AddressState string `json:"address_state" validate:"omitempty,max=100"`
// address_postal_code is the ZIP code or postal code with maximum 20 characters
AddressPostalCode string `json:"address_postal_code" validate:"omitempty,max=20"`
// address_country is the two-letter ISO 3166-1 alpha-2 country code
AddressCountry string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
// metadata contains additional key-value pairs for storing extra information
Metadata map[string]string `json:"metadata,omitempty"`
// skip_onboarding_workflow when true, prevents the customer onboarding workflow from being triggered
// This is used internally when a customer is created via a workflow to prevent infinite loops
// Default: false
SkipOnboardingWorkflow bool `json:"skip_onboarding_workflow,omitempty"`
// tax_rate_overrides contains tax rate configurations to be linked to this customer
TaxRateOverrides []*TaxRateOverride `json:"tax_rate_overrides,omitempty"`
// integration_entity_mapping contains provider integration mappings for this customer
IntegrationEntityMapping []*IntegrationEntityMapping `json:"integration_entity_mapping,omitempty"`
// parent_customer_id is the internal FlexPrice ID of the parent customer
ParentCustomerID *string `json:"parent_customer_id,omitempty"`
// parent_customer_external_id is the external ID of the parent customer from your system
// Exactly one of parent_customer_id or parent_customer_external_id may be provided
ParentCustomerExternalID *string `json:"parent_customer_external_id,omitempty"`
}
CreateCustomerRequest represents the request to create a new customer @Description Request object for creating a new customer in the system
func (*CreateCustomerRequest) ToCustomer ¶
func (r *CreateCustomerRequest) ToCustomer(ctx context.Context) *customer.Customer
func (*CreateCustomerRequest) Validate ¶
func (r *CreateCustomerRequest) Validate() error
type CreateEntitlementRequest ¶
type CreateEntitlementRequest struct {
PlanID string `json:"plan_id,omitempty"`
FeatureID string `json:"feature_id" binding:"required"`
FeatureType types.FeatureType `json:"feature_type" binding:"required"`
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit"`
UsageResetPeriod types.EntitlementUsageResetPeriod `json:"usage_reset_period"`
IsSoftLimit bool `json:"is_soft_limit"`
StaticValue string `json:"static_value"`
EntityType types.EntitlementEntityType `json:"entity_type"`
EntityID string `json:"entity_id"`
ParentEntitlementID *string `json:"parent_entitlement_id,omitempty"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
}
CreateEntitlementRequest represents the request to create a new entitlement
func (*CreateEntitlementRequest) ToEntitlement ¶
func (r *CreateEntitlementRequest) ToEntitlement(ctx context.Context) *entitlement.Entitlement
func (*CreateEntitlementRequest) Validate ¶
func (r *CreateEntitlementRequest) Validate() error
type CreateEntityIntegrationMappingRequest ¶ added in v1.0.21
type CreateEntityIntegrationMappingRequest struct {
EntityID string `json:"entity_id" validate:"required,max=255"`
EntityType types.IntegrationEntityType `json:"entity_type" validate:"required"`
ProviderType string `json:"provider_type" validate:"required,max=50"`
ProviderEntityID string `json:"provider_entity_id" validate:"required,max=255"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
func (*CreateEntityIntegrationMappingRequest) ToEntityIntegrationMapping ¶ added in v1.0.21
func (r *CreateEntityIntegrationMappingRequest) ToEntityIntegrationMapping(ctx context.Context) *entityintegrationmapping.EntityIntegrationMapping
func (*CreateEntityIntegrationMappingRequest) Validate ¶ added in v1.0.21
func (r *CreateEntityIntegrationMappingRequest) Validate() error
type CreateEnvironmentRequest ¶
type CreateEnvironmentRequest struct {
Name string `json:"name" validate:"required"`
Type string `json:"type" validate:"required"`
}
func (*CreateEnvironmentRequest) ToEnvironment ¶
func (r *CreateEnvironmentRequest) ToEnvironment(ctx context.Context) *environment.Environment
func (*CreateEnvironmentRequest) Validate ¶
func (r *CreateEnvironmentRequest) Validate() error
type CreateFeatureRequest ¶
type CreateFeatureRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
LookupKey string `json:"lookup_key"`
Type types.FeatureType `json:"type" binding:"required"`
MeterID string `json:"meter_id,omitempty"`
Meter *CreateMeterRequest `json:"meter,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
UnitSingular string `json:"unit_singular,omitempty"`
UnitPlural string `json:"unit_plural,omitempty"`
AlertSettings *types.AlertSettings `json:"alert_settings,omitempty"`
}
func (*CreateFeatureRequest) Validate ¶
func (r *CreateFeatureRequest) Validate() error
type CreateGroupRequest ¶ added in v1.0.34
type CreateGroupRequest struct {
Name string `json:"name" validate:"required"`
EntityType string `json:"entity_type" validate:"required"`
LookupKey string `json:"lookup_key" validate:"required"`
}
CreateGroupRequest represents the request to create a group
func (*CreateGroupRequest) Validate ¶ added in v1.0.34
func (r *CreateGroupRequest) Validate() error
type CreateIntegrationRequest ¶
type CreateIntegrationRequest struct {
Name string `json:"name" binding:"required"`
Provider types.SecretProvider `json:"provider" binding:"required"`
Credentials map[string]string `json:"credentials" binding:"required"`
}
CreateIntegrationRequest represents the request to create/update an integration
func (*CreateIntegrationRequest) Validate ¶
func (r *CreateIntegrationRequest) Validate() error
type CreateInvoiceLineItemRequest ¶
type CreateInvoiceLineItemRequest struct {
// entity_id is the optional unique identifier of the entity associated with this line item
EntityID *string `json:"entity_id,omitempty"`
// entity_type is the optional type of the entity associated with this line item
EntityType *string `json:"entity_type,omitempty"`
// price_id is the optional unique identifier of the price associated with this line item
PriceID *string `json:"price_id,omitempty"`
// plan_display_name is the optional human-readable name of the plan
PlanDisplayName *string `json:"plan_display_name,omitempty"`
// price_type indicates the type of pricing (fixed, usage, tiered, etc.)
PriceType *string `json:"price_type,omitempty"`
// meter_id is the optional unique identifier of the meter used for usage tracking
MeterID *string `json:"meter_id,omitempty"`
// meter_display_name is the optional human-readable name of the meter
MeterDisplayName *string `json:"meter_display_name,omitempty"`
// price_unit is the optional 3-digit ISO code of the price unit associated with this line item
PriceUnit *string `json:"price_unit,omitempty"`
// price_unit_amount is the optional amount converted to the price unit currency
PriceUnitAmount *decimal.Decimal `json:"price_unit_amount,omitempty" swaggertype:"string"`
// display_name is the optional human-readable name for this line item
DisplayName *string `json:"display_name,omitempty"`
// amount is the monetary amount for this line item
Amount decimal.Decimal `json:"amount" validate:"required" swaggertype:"string"`
// quantity is the quantity of units for this line item
Quantity decimal.Decimal `json:"quantity" validate:"required" swaggertype:"string"`
// period_start is the optional start date of the period this line item covers
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end is the optional end date of the period this line item covers
PeriodEnd *time.Time `json:"period_end,omitempty"`
// metadata contains additional custom key-value pairs for storing extra information about this line item
Metadata types.Metadata `json:"metadata,omitempty"`
// TODO: !REMOVE after migration
// plan_id is the optional unique identifier of the plan associated with this line item
PlanID *string `json:"plan_id,omitempty"`
// commitment_info contains details about any commitment applied to this line item
CommitmentInfo *types.CommitmentInfo `json:"commitment_info,omitempty"`
}
CreateInvoiceLineItemRequest represents a single line item in an invoice creation request
func (*CreateInvoiceLineItemRequest) ToInvoiceLineItem ¶
func (r *CreateInvoiceLineItemRequest) ToInvoiceLineItem(ctx context.Context, inv *invoice.Invoice) *invoice.InvoiceLineItem
func (*CreateInvoiceLineItemRequest) Validate ¶
func (r *CreateInvoiceLineItemRequest) Validate(invoiceType types.InvoiceType) error
type CreateInvoiceRequest ¶
type CreateInvoiceRequest struct {
// invoice_number is an optional human-readable identifier for the invoice
InvoiceNumber *string `json:"invoice_number,omitempty"`
// customer_id is the unique identifier of the customer this invoice belongs to
CustomerID string `json:"customer_id" validate:"required"`
// subscription_id is the optional unique identifier of the subscription associated with this invoice
SubscriptionID *string `json:"subscription_id,omitempty"`
// idempotency_key is an optional key used to prevent duplicate invoice creation
IdempotencyKey *string `json:"idempotency_key"`
// invoice_type indicates the type of invoice (subscription, one_time, etc.)
InvoiceType types.InvoiceType `json:"invoice_type"`
// currency is the three-letter ISO currency code (e.g., USD, EUR) for the invoice
Currency string `json:"currency" validate:"required"`
// amount_due is the total amount that needs to be paid for this invoice
AmountDue decimal.Decimal `json:"amount_due" validate:"required" swaggertype:"string"`
// total is the total amount of the invoice including taxes and discounts
Total decimal.Decimal `json:"total" validate:"required" swaggertype:"string"`
// subtotal is the amount before taxes and discounts are applied
Subtotal decimal.Decimal `json:"subtotal" validate:"required" swaggertype:"string"`
// description is an optional text description of the invoice
Description string `json:"description,omitempty"`
// due_date is the date by which payment is expected
DueDate *time.Time `json:"due_date,omitempty"`
// billing_period is the period this invoice covers (e.g., "monthly", "yearly")
BillingPeriod *string `json:"billing_period,omitempty"`
// period_start is the start date of the billing period
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end is the end date of the billing period
PeriodEnd *time.Time `json:"period_end,omitempty"`
// billing_reason indicates why this invoice was created (subscription_cycle, manual, etc.)
BillingReason types.InvoiceBillingReason `json:"billing_reason"`
// invoice_status represents the current status of the invoice (draft, finalized, etc.)
InvoiceStatus *types.InvoiceStatus `json:"invoice_status,omitempty"`
// payment_status represents the payment status of the invoice (unpaid, paid, etc.)
PaymentStatus *types.PaymentStatus `json:"payment_status,omitempty"`
// amount_paid is the amount that has been paid towards this invoice
AmountPaid *decimal.Decimal `json:"amount_paid,omitempty" swaggertype:"string"`
// line_items contains the individual items that make up this invoice
LineItems []CreateInvoiceLineItemRequest `json:"line_items,omitempty"`
// coupons
Coupons []string `json:"coupons,omitempty"`
// tax_rates
TaxRates []string `json:"tax_rates,omitempty"`
// Invoice Coupns
InvoiceCoupons []InvoiceCoupon `json:"invoice_coupons,omitempty"`
// Invoice Line Item Coupons
LineItemCoupons []InvoiceLineItemCoupon `json:"line_item_coupons,omitempty"`
// metadata contains additional custom key-value pairs for storing extra information
Metadata types.Metadata `json:"metadata,omitempty"`
// tax_rate_overrides is the tax rate overrides to be applied to the invoice
TaxRateOverrides []*TaxRateOverride `json:"tax_rate_overrides,omitempty"`
// prepared_tax_rates contains the tax rates pre-resolved by the caller (e.g., billing service)
// These are applied at invoice level by the invoice service without further resolution
PreparedTaxRates []*TaxRateResponse `json:"prepared_tax_rates,omitempty"`
// environment_id is the unique identifier of the environment this invoice belongs to
EnvironmentID string `json:"environment_id,omitempty"`
// invoice_pdf_url is the URL where customers can download the PDF version of this invoice
InvoicePDFURL *string `json:"invoice_pdf_url,omitempty"`
}
CreateInvoiceRequest represents the request payload for creating a new invoice
func (*CreateInvoiceRequest) Validate ¶
func (r *CreateInvoiceRequest) Validate() error
type CreateMeterRequest ¶
type CreateMeterRequest struct {
Name string `json:"name" binding:"required" example:"API Usage Meter"`
EventName string `json:"event_name" binding:"required" example:"api_request"`
Aggregation meter.Aggregation `json:"aggregation" binding:"required"`
Filters []meter.Filter `json:"filters"`
ResetUsage types.ResetUsage `json:"reset_usage" binding:"required"`
}
CreateMeterRequest represents the request payload for creating a meter
func (*CreateMeterRequest) ToMeter ¶
func (r *CreateMeterRequest) ToMeter(tenantID, createdBy string) *meter.Meter
Convert CreateMeterRequest to domain Meter
func (*CreateMeterRequest) Validate ¶
func (r *CreateMeterRequest) Validate() error
Request validations
type CreatePaymentLinkRequest ¶ added in v1.0.21
type CreatePaymentLinkRequest struct {
InvoiceID string `json:"invoice_id" binding:"required"`
CustomerID string `json:"customer_id" binding:"required"`
Amount decimal.Decimal `json:"amount" binding:"required" swaggertype:"string"`
Currency string `json:"currency" binding:"required"`
Gateway *types.PaymentGatewayType `json:"gateway,omitempty"` // Optional, will use preferred if not specified
SuccessURL string `json:"success_url,omitempty"`
CancelURL string `json:"cancel_url,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
Description string `json:"description,omitempty"`
SaveCardAndMakeDefault bool `json:"save_card_and_make_default" default:"false"`
}
CreatePaymentLinkRequest represents a generic payment link creation request
func (*CreatePaymentLinkRequest) Validate ¶ added in v1.0.21
func (r *CreatePaymentLinkRequest) Validate() error
Validate validates the payment link request
type CreatePaymentRequest ¶
type CreatePaymentRequest struct {
IdempotencyKey string `json:"idempotency_key,omitempty"`
DestinationType types.PaymentDestinationType `json:"destination_type" binding:"required"`
DestinationID string `json:"destination_id" binding:"required"`
PaymentMethodType types.PaymentMethodType `json:"payment_method_type" binding:"required"`
PaymentMethodID string `json:"payment_method_id"`
PaymentGateway *types.PaymentGatewayType `json:"payment_gateway,omitempty"`
Amount decimal.Decimal `json:"amount" binding:"required" swaggertype:"string"`
Currency string `json:"currency" binding:"required"`
SuccessURL string `json:"success_url,omitempty"`
CancelURL string `json:"cancel_url,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
ProcessPayment bool `json:"process_payment" default:"true"`
SaveCardAndMakeDefault bool `json:"save_card_and_make_default" default:"false"`
}
CreatePaymentRequest represents a request to create a payment
type CreatePlanEntitlementRequest ¶
type CreatePlanEntitlementRequest struct {
*CreateEntitlementRequest
}
func (*CreatePlanEntitlementRequest) ToEntitlement ¶
func (r *CreatePlanEntitlementRequest) ToEntitlement(ctx context.Context, planID string) *entitlement.Entitlement
func (*CreatePlanEntitlementRequest) Validate ¶ added in v1.0.21
func (r *CreatePlanEntitlementRequest) Validate() error
Validate validates the entitlement when provided inline within a plan creation request.
type CreatePlanPriceRequest ¶
type CreatePlanPriceRequest struct {
*CreatePriceRequest
}
type CreatePlanRequest ¶
type CreatePlanRequest struct {
Name string `json:"name" validate:"required"`
LookupKey string `json:"lookup_key"`
Description string `json:"description"`
DisplayOrder *int `json:"display_order,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
func (*CreatePlanRequest) ToCreditGrant ¶ added in v1.0.18
func (r *CreatePlanRequest) ToCreditGrant(ctx context.Context, planID string, creditGrantReq CreateCreditGrantRequest) *creditgrant.CreditGrant
func (*CreatePlanRequest) ToPlan ¶
func (r *CreatePlanRequest) ToPlan(ctx context.Context) *plan.Plan
func (*CreatePlanRequest) Validate ¶
func (r *CreatePlanRequest) Validate() error
type CreatePlanResponse ¶
type CreatePriceRequest ¶
type CreatePriceRequest struct {
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
Currency string `json:"currency" validate:"required,len=3"`
EntityType types.PriceEntityType `json:"entity_type" validate:"required"`
EntityID string `json:"entity_id" validate:"required"`
Type types.PriceType `json:"type" validate:"required"`
PriceUnitType types.PriceUnitType `json:"price_unit_type" validate:"required"`
BillingPeriod types.BillingPeriod `json:"billing_period" validate:"required"`
BillingPeriodCount int `json:"billing_period_count" default:"1"`
BillingModel types.BillingModel `json:"billing_model" validate:"required"`
BillingCadence types.BillingCadence `json:"billing_cadence" validate:"required"`
MeterID string `json:"meter_id,omitempty"`
FilterValues map[string][]string `json:"filter_values,omitempty"`
LookupKey string `json:"lookup_key,omitempty"`
InvoiceCadence types.InvoiceCadence `json:"invoice_cadence" validate:"required"`
TrialPeriod int `json:"trial_period"`
Description string `json:"description,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
TierMode types.BillingTier `json:"tier_mode,omitempty"`
Tiers []CreatePriceTier `json:"tiers,omitempty"`
TransformQuantity *price.TransformQuantity `json:"transform_quantity,omitempty"`
PriceUnitConfig *PriceUnitConfig `json:"price_unit_config,omitempty"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
DisplayName string `json:"display_name,omitempty"`
// MinQuantity is the minimum quantity of the price
MinQuantity *int64 `json:"min_quantity,omitempty"`
// SkipEntityValidation is used to skip entity validation when creating a price from a subscription i.e. override price workflow
// This is used when creating a subscription-scoped price
// NOTE: This is not a public field and is used internally should be used with caution
SkipEntityValidation bool `json:"-"`
// ParentPriceID is the id of the parent price for this price
ParentPriceID string `json:"-"`
// GroupID is the id of the group to add the price to
GroupID string `json:"group_id,omitempty"`
}
func (*CreatePriceRequest) ToPrice ¶
func (r *CreatePriceRequest) ToPrice(ctx context.Context) (*priceDomain.Price, error)
ToPrice converts the request to a Price domain object Service layer should handle price unit conversion BEFORE calling this method
func (*CreatePriceRequest) Validate ¶
func (r *CreatePriceRequest) Validate() error
Validate validates the create price request
type CreatePriceTier ¶
type CreatePriceTier struct {
// up_to is the quantity up to which this tier applies. It is null for the last tier.
// IMPORTANT: Tier boundaries are INCLUSIVE.
// - If up_to is 1000, then quantity less than or equal to 1000 belongs to this tier
// - This behavior is consistent across both VOLUME and SLAB tier modes
UpTo *uint64 `json:"up_to"`
// unit_amount is the amount per unit for the given tier
UnitAmount decimal.Decimal `json:"unit_amount" validate:"required" swaggertype:"string"`
// flat_amount is the flat amount for the given tier (optional)
// Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c"
FlatAmount *decimal.Decimal `json:"flat_amount,omitempty" swaggertype:"string"`
}
func (*CreatePriceTier) Validate ¶ added in v1.0.49
func (t *CreatePriceTier) Validate() error
Validate validates the tier structure
type CreatePriceUnitRequest ¶ added in v1.0.21
type CreatePriceUnitRequest struct {
Name string `json:"name" validate:"required"`
Code string `json:"code" validate:"required"`
Symbol string `json:"symbol" validate:"required"`
// base_currency is the currency that the price unit is based on
BaseCurrency string `json:"base_currency" validate:"required,len=3"`
// ConversionRate defines the exchange rate from this price unit to the base currency.
// This rate is used to convert amounts in the custom price unit to the base currency for storage and billing.
//
// Conversion formula:
// price_unit_amount * conversion_rate = base_currency_amount
//
// Example:
// If conversion_rate = "0.01" and base_currency = "usd":
// 100 price_unit tokens * 0.01 = 1.00 USD
//
// Note: Rounding precision is determined by the base currency (e.g., USD uses 2 decimal places, JPY uses 0).
ConversionRate string `json:"conversion_rate" validate:"required"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
func (*CreatePriceUnitRequest) ToPriceUnit ¶ added in v1.0.49
func (*CreatePriceUnitRequest) Validate ¶ added in v1.0.49
func (r *CreatePriceUnitRequest) Validate() error
type CreatePriceUnitResponse ¶ added in v1.0.49
type CreateProrationInvoiceRequest ¶ added in v1.0.25
type CreateProrationInvoiceRequest struct {
// subscription_id is the unique identifier of the subscription this proration relates to
SubscriptionID string `json:"subscription_id" validate:"required"`
// customer_id is the unique identifier of the customer
CustomerID string `json:"customer_id" validate:"required"`
// proration_result contains the calculated proration details
ProrationResult *ProrationResult `json:"proration_result" validate:"required"`
// description is the human-readable description for the invoice
Description string `json:"description,omitempty"`
// effective_date is when the proration takes effect
EffectiveDate time.Time `json:"effective_date" validate:"required"`
// cancellation_type indicates the type of cancellation (for metadata)
CancellationType string `json:"cancellation_type,omitempty"`
// cancellation_reason is the business reason for the cancellation
CancellationReason string `json:"cancellation_reason,omitempty"`
}
CreateProrationInvoiceRequest represents the request for creating a proration invoice
type CreateScheduledTaskRequest ¶ added in v1.0.32
type CreateScheduledTaskRequest struct {
ConnectionID string `json:"connection_id" binding:"required" validate:"required"`
EntityType types.ScheduledTaskEntityType `json:"entity_type" binding:"required" validate:"required"`
Interval types.ScheduledTaskInterval `json:"interval" binding:"required" validate:"required" enums:"hourly,daily"` // Note: "custom" is excluded from API (internal testing only)
Enabled bool `json:"enabled"`
JobConfig *types.S3JobConfig `json:"job_config" binding:"required" validate:"required"`
}
CreateScheduledTaskRequest represents a request to create a scheduled task
func (*CreateScheduledTaskRequest) ToCreateInput ¶ added in v1.0.32
func (r *CreateScheduledTaskRequest) ToCreateInput() *types.CreateScheduledTaskInput
ToCreateScheduledTaskInput converts request to domain input
func (*CreateScheduledTaskRequest) Validate ¶ added in v1.0.32
func (r *CreateScheduledTaskRequest) Validate() error
Validate validates the create request
type CreateSettingRequest ¶ added in v1.0.22
type CreateSettingRequest struct {
Key types.SettingKey `json:"key" validate:"required"`
Value map[string]interface{} `json:"value,omitempty"`
}
CreateSettingRequest represents the request to create a new setting
func (*CreateSettingRequest) ToSetting ¶ added in v1.0.22
func (r *CreateSettingRequest) ToSetting(ctx context.Context) *settings.Setting
func (*CreateSettingRequest) Validate ¶ added in v1.0.22
func (r *CreateSettingRequest) Validate() error
type CreateSetupIntentRequest ¶ added in v1.0.28
type CreateSetupIntentRequest struct {
Provider string `json:"provider" binding:"required"` // Payment provider: "stripe", "razorpay", etc.
Usage string `json:"usage,omitempty"` // "on_session" or "off_session" (default: "off_session")
PaymentMethodTypes []string `json:"payment_method_types,omitempty"` // defaults to ["card"]
SuccessURL string `json:"success_url,omitempty"` // User-configurable success redirect URL
CancelURL string `json:"cancel_url,omitempty"` // User-configurable cancel redirect URL
SetDefault bool `json:"set_default,omitempty"` // Whether to set the payment method as default when setup succeeds
Metadata types.Metadata `json:"metadata,omitempty"`
}
CreateSetupIntentRequest represents a request to create a Setup Intent session
func (*CreateSetupIntentRequest) Validate ¶ added in v1.0.28
func (r *CreateSetupIntentRequest) Validate() error
Validate validates the create Setup Intent request
type CreateStripePaymentLinkRequest ¶ added in v1.0.21
type CreateStripePaymentLinkRequest struct {
InvoiceID string `json:"invoice_id" binding:"required"`
CustomerID string `json:"customer_id" binding:"required"`
Amount decimal.Decimal `json:"amount" binding:"required" swaggertype:"string"`
Currency string `json:"currency" binding:"required"`
SuccessURL string `json:"success_url,omitempty"`
CancelURL string `json:"cancel_url,omitempty"`
EnvironmentID string `json:"environment_id" binding:"required"`
Metadata types.Metadata `json:"metadata,omitempty"`
SaveCardAndMakeDefault bool `json:"save_card_and_make_default" default:"false"`
PaymentID string `json:"payment_id" binding:"required"`
}
CreateStripePaymentLinkRequest represents a request to create a Stripe payment link
func (*CreateStripePaymentLinkRequest) Validate ¶ added in v1.0.21
func (r *CreateStripePaymentLinkRequest) Validate() error
Validate validates the create Stripe payment link request
type CreateSubscriptionInvoiceRequest ¶
type CreateSubscriptionInvoiceRequest struct {
// subscription_id is the unique identifier of the subscription to create an invoice for
SubscriptionID string `json:"subscription_id" binding:"required"`
// period_start is the start date of the billing period for this invoice
PeriodStart time.Time `json:"period_start" binding:"required"`
// period_end is the end date of the billing period for this invoice
PeriodEnd time.Time `json:"period_end" binding:"required"`
// is_preview indicates whether this is a preview invoice (not saved to database)
IsPreview bool `json:"is_preview"`
// reference_point defines the point in time used for calculating usage and charges
ReferencePoint types.InvoiceReferencePoint `json:"reference_point"`
}
CreateSubscriptionInvoiceRequest represents the request payload for creating a subscription invoice
func (*CreateSubscriptionInvoiceRequest) Validate ¶ added in v1.0.0
func (r *CreateSubscriptionInvoiceRequest) Validate() error
type CreateSubscriptionLineItemRequest ¶ added in v1.0.23
type CreateSubscriptionLineItemRequest struct {
PriceID string `json:"price_id" validate:"required"`
Quantity decimal.Decimal `json:"quantity,omitempty"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
DisplayName string `json:"display_name,omitempty"`
SubscriptionPhaseID *string `json:"subscription_phase_id,omitempty"`
SkipEntitlementCheck bool `json:"-"` // This is used to skip entitlement check when creating a subscription line item
// Commitment fields
CommitmentAmount *decimal.Decimal `json:"commitment_amount,omitempty"`
CommitmentQuantity *decimal.Decimal `json:"commitment_quantity,omitempty"`
CommitmentType types.CommitmentType `json:"commitment_type,omitempty"`
CommitmentOverageFactor *decimal.Decimal `json:"commitment_overage_factor,omitempty"`
CommitmentTrueUpEnabled bool `json:"commitment_true_up_enabled,omitempty"`
CommitmentWindowed bool `json:"commitment_windowed,omitempty"`
}
CreateSubscriptionLineItemRequest represents the request to create a subscription line item
func (*CreateSubscriptionLineItemRequest) HasCommitment ¶ added in v1.0.47
func (r *CreateSubscriptionLineItemRequest) HasCommitment() bool
HasCommitment returns true if the request has commitment configured
func (*CreateSubscriptionLineItemRequest) ToSubscriptionLineItem ¶ added in v1.0.23
func (r *CreateSubscriptionLineItemRequest) ToSubscriptionLineItem(ctx context.Context, params LineItemParams) *subscription.SubscriptionLineItem
ToSubscriptionLineItem converts the request to a domain subscription line item
type CreateSubscriptionPhaseRequest ¶ added in v1.0.38
type CreateSubscriptionPhaseRequest struct {
// subscription_id is the identifier for the subscription
SubscriptionID string `json:"subscription_id" validate:"required"`
// start_date is when the phase starts (required)
StartDate *time.Time `json:"start_date" validate:"required"`
// end_date is when the phase ends (nil if phase is indefinite)
EndDate *time.Time `json:"end_date,omitempty"`
// metadata contains additional key-value pairs
Metadata types.Metadata `json:"metadata,omitempty"`
}
CreateSubscriptionPhaseRequest represents the request to create a subscription phase
func (*CreateSubscriptionPhaseRequest) ToSubscriptionPhase ¶ added in v1.0.38
func (r *CreateSubscriptionPhaseRequest) ToSubscriptionPhase(ctx context.Context) *subscription.SubscriptionPhase
ToSubscriptionPhase converts the request to a domain SubscriptionPhase
func (*CreateSubscriptionPhaseRequest) Validate ¶ added in v1.0.38
func (r *CreateSubscriptionPhaseRequest) Validate() error
Validate validates the CreateSubscriptionPhaseRequest
type CreateSubscriptionRequest ¶
type CreateSubscriptionRequest struct {
// customer_id is the flexprice customer id
// and it is prioritized over external_customer_id in case both are provided.
CustomerID string `json:"customer_id"`
// external_customer_id is the customer id in your DB
// and must be same as what you provided as external_id while creating the customer in flexprice.
ExternalCustomerID string `json:"external_customer_id"`
// invoicing_customer_id is the customer ID to use for invoicing
// This can differ from the subscription customer (e.g., parent company invoicing for child company)
// This field is set internally based on InvoiceBillingConfig and is not exposed in the API
InvoicingCustomerID *string `json:"-"`
// invoice_billing determines which customer should receive invoices for a subscription
// "invoice_to_parent" - Invoices are sent to the parent customer
// "invoice_to_self" - Invoices are sent to the subscription's customer
InvoiceBilling *types.InvoiceBilling `json:"invoice_billing,omitempty"`
PlanID string `json:"plan_id" validate:"required"`
Currency string `json:"currency" validate:"required,len=3"`
LookupKey string `json:"lookup_key"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
TrialStart *time.Time `json:"trial_start,omitempty"`
TrialEnd *time.Time `json:"trial_end,omitempty"`
BillingCadence types.BillingCadence `json:"billing_cadence" validate:"required"`
BillingPeriod types.BillingPeriod `json:"billing_period" validate:"required"`
BillingPeriodCount int `json:"billing_period_count" default:"1"`
Metadata map[string]string `json:"metadata,omitempty"`
// BillingCycle is the cycle of the billing anchor.
// This is used to determine the billing date for the subscription (i.e set the billing anchor)
// If not set, the default value is anniversary. Possible values are anniversary and calendar.
// Anniversary billing means the billing anchor will be the start date of the subscription.
// Calendar billing means the billing anchor will be the appropriate date based on the billing period.
// For example, if the billing period is month and the start date is 2025-04-15 then in case of
// calendar billing the billing anchor will be 2025-05-01 vs 2025-04-15 for anniversary billing.
BillingCycle types.BillingCycle `json:"billing_cycle"`
// Credit grants to be applied when subscription is created
CreditGrants []CreateCreditGrantRequest `json:"credit_grants,omitempty"`
// CommitmentAmount is the minimum amount a customer commits to paying for a billing period
CommitmentAmount *decimal.Decimal `json:"commitment_amount,omitempty" swaggertype:"string"`
// OverageFactor is a multiplier applied to usage beyond the commitment amount
OverageFactor *decimal.Decimal `json:"overage_factor,omitempty" swaggertype:"string"`
// tax_rate_overrides is the tax rate overrides to be applied to the subscription
TaxRateOverrides []*TaxRateOverride `json:"tax_rate_overrides,omitempty"`
Coupons []string `json:"coupons,omitempty"`
LineItemCoupons map[string][]string `json:"line_item_coupons,omitempty"`
// LineItemCommitments allows setting commitment configuration per line item (keyed by price_id)
LineItemCommitments map[string]*LineItemCommitmentConfig `json:"line_item_commitments,omitempty" validate:"omitempty,dive"`
// OverrideLineItems allows customizing specific prices for this subscription
OverrideLineItems []OverrideLineItemRequest `json:"override_line_items,omitempty" validate:"omitempty,dive"`
// OverrideEntitlements allows customizing specific entitlements for this subscription
OverrideEntitlements []OverrideEntitlementRequest `json:"override_entitlements,omitempty" validate:"omitempty,dive"`
// Addons represents addons to be added to the subscription during creation
Addons []AddAddonToSubscriptionRequest `json:"addons,omitempty" validate:"omitempty,dive"`
// Phases represents subscription phases to be created with the subscription
Phases []SubscriptionPhaseCreateRequest `json:"phases,omitempty" validate:"omitempty,dive"`
// Payment behavior configuration
PaymentBehavior *types.PaymentBehavior `json:"payment_behavior,omitempty"`
GatewayPaymentMethodID *string `json:"gateway_payment_method_id,omitempty"`
// collection_method determines how invoices are collected
// "default_incomplete" - subscription waits for payment confirmation before activation
// "send_invoice" - subscription activates immediately, invoice is sent for payment
CollectionMethod *types.CollectionMethod `json:"collection_method,omitempty"`
// ProrationBehavior controls how proration is handled.
// If not set, the default value is none. Possible values are create_prorations and none.
// create_prorations means the proration will be calculated and applied.
// none means the proration will not be calculated.
// This is IGNORED when the billing cycle is anniversary.
ProrationBehavior types.ProrationBehavior `json:"proration_behavior,omitempty"`
// Timezone of the customer.
// If not set, the default value is UTC.
CustomerTimezone string `json:"customer_timezone" validate:"omitempty,timezone"`
//Billing Anchor
BillingAnchor *time.Time `json:"-"`
// Workflow
Workflow *types.TemporalWorkflowType `json:"-"`
// SubscriptionStatus determines the initial status of the subscription
// If set to "draft", the subscription will be created as a draft (skips invoice creation and payment processing)
SubscriptionStatus types.SubscriptionStatus `json:"subscription_status,omitempty"`
// Enable Commitment True Up Fee
EnableTrueUp bool `json:"enable_true_up"`
}
func (*CreateSubscriptionRequest) ToSubscription ¶
func (r *CreateSubscriptionRequest) ToSubscription(ctx context.Context) *subscription.Subscription
func (*CreateSubscriptionRequest) Validate ¶
func (r *CreateSubscriptionRequest) Validate() error
type CreateTaskRequest ¶
type CreateTaskRequest struct {
TaskType types.TaskType `json:"task_type" binding:"required"`
EntityType types.EntityType `json:"entity_type" binding:"required"`
FileURL string `json:"file_url" binding:"required"`
FileName *string `json:"file_name,omitempty"`
FileType types.FileType `json:"file_type" binding:"required"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
CreateTaskRequest represents the request to create a new task
func (*CreateTaskRequest) ToTask ¶
func (r *CreateTaskRequest) ToTask(ctx context.Context) *task.Task
ToTask converts the request to a domain task
func (*CreateTaskRequest) Validate ¶
func (r *CreateTaskRequest) Validate() error
type CreateTaxAppliedRequest ¶ added in v1.0.21
type CreateTaxAppliedRequest struct {
TaxRateID string `json:"tax_rate_id" validate:"required"`
EntityType types.TaxRateEntityType `json:"entity_type" validate:"required"`
EntityID string `json:"entity_id" validate:"required"`
TaxableAmount decimal.Decimal `json:"taxable_amount" validate:"required" swaggertype:"string"`
TaxAmount decimal.Decimal `json:"tax_amount" validate:"required" swaggertype:"string"`
Currency string `json:"currency" validate:"required"`
TaxAssociationID *string `json:"tax_association_id,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (*CreateTaxAppliedRequest) ToTaxApplied ¶ added in v1.0.21
func (r *CreateTaxAppliedRequest) ToTaxApplied(ctx context.Context) *taxapplied.TaxApplied
func (*CreateTaxAppliedRequest) Validate ¶ added in v1.0.21
func (r *CreateTaxAppliedRequest) Validate() error
type CreateTaxAssociationRequest ¶ added in v1.0.21
type CreateTaxAssociationRequest struct {
TaxRateCode string `json:"tax_rate_code" binding:"required"`
EntityType types.TaxRateEntityType `json:"entity_type" binding:"required"`
EntityID string `json:"entity_id" binding:"required"`
Priority int `json:"priority" binding:"omitempty"`
Currency string `json:"currency" binding:"omitempty"`
AutoApply bool `json:"auto_apply" binding:"omitempty"`
Metadata map[string]string `json:"metadata" binding:"omitempty"`
}
func (*CreateTaxAssociationRequest) ToTaxAssociation ¶ added in v1.0.21
func (r *CreateTaxAssociationRequest) ToTaxAssociation(ctx context.Context, taxRateID string) *taxassociation.TaxAssociation
func (*CreateTaxAssociationRequest) Validate ¶ added in v1.0.21
func (r *CreateTaxAssociationRequest) Validate() error
type CreateTaxRateRequest ¶ added in v1.0.21
type CreateTaxRateRequest struct {
// name is the human-readable name for the tax rate (required)
Name string `json:"name" validate:"required"`
// code is the unique alphanumeric case sensitive identifier for the tax rate (required)
Code string `json:"code" validate:"required"`
// description is an optional text description providing details about the tax rate
Description string `json:"description,omitempty"`
// percentage_value is the percentage value (0-100) when tax_rate_type is "percentage"
PercentageValue *decimal.Decimal `json:"percentage_value,omitempty" swaggertype:"string"`
// fixed_value is the fixed monetary amount when tax_rate_type is "fixed"
FixedValue *decimal.Decimal `json:"fixed_value,omitempty" swaggertype:"string"`
// tax_rate_type determines how the tax is calculated ("percentage" or "fixed")
TaxRateType types.TaxRateType `json:"tax_rate_type"`
// scope defines where this tax rate applies
Scope *types.TaxRateScope `json:"scope,omitempty"`
// metadata contains additional key-value pairs for storing extra information
Metadata map[string]string `json:"metadata,omitempty"`
}
CreateTaxRateRequest represents the request to create a tax rate
func (CreateTaxRateRequest) ToTaxRate ¶ added in v1.0.21
func (r CreateTaxRateRequest) ToTaxRate(ctx context.Context) *taxrate.TaxRate
ToTaxRate converts a CreateTaxRateRequest to a domain TaxRate
func (CreateTaxRateRequest) Validate ¶ added in v1.0.21
func (r CreateTaxRateRequest) Validate() error
Validate validates the CreateTaxRateRequest
type CreateTenantRequest ¶
type CreateTenantRequest struct {
Name string `json:"name" validate:"required"`
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
ID string `json:"-"`
}
func (*CreateTenantRequest) ToTenant ¶
func (r *CreateTenantRequest) ToTenant(ctx context.Context) *tenant.Tenant
func (*CreateTenantRequest) Validate ¶
func (r *CreateTenantRequest) Validate() error
type CreateUserRequest ¶ added in v1.0.36
type CreateUserRequest struct {
Type types.UserType `json:"type" binding:"required" validate:"required"` // Must be "service_account"
Roles []string `json:"roles" binding:"required,min=1" validate:"required,min=1"` // Roles are required
}
CreateUserRequest represents the request to create a new user (service accounts only)
func (*CreateUserRequest) Validate ¶ added in v1.0.36
func (r *CreateUserRequest) Validate() error
type CreateWalletRequest ¶
type CreateWalletRequest struct {
CustomerID string `json:"customer_id,omitempty"`
// external_customer_id is the customer id in the external system
ExternalCustomerID string `json:"external_customer_id,omitempty"`
Name string `json:"name,omitempty"`
Currency string `json:"currency" binding:"required"`
Description string `json:"description,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
WalletType types.WalletType `json:"wallet_type"`
Config *types.WalletConfig `json:"config,omitempty"`
// amount in the currency = number of credits * conversion_rate
// ex if conversion_rate is 1, then 1 USD = 1 credit
// ex if conversion_rate is 2, then 1 USD = 0.5 credits
// ex if conversion_rate is 0.5, then 1 USD = 2 credits
ConversionRate decimal.Decimal `json:"conversion_rate" default:"1" swaggertype:"string"`
// topup_conversion_rate is the conversion rate for the topup to the currency
// ex if topup_conversion_rate is 1, then 1 USD = 1 credit
// ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits
// ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
TopupConversionRate *decimal.Decimal `json:"topup_conversion_rate,omitempty" swaggertype:"string"`
// initial_credits_to_load is the number of credits to load to the wallet
// if not provided, the wallet will be created with 0 balance
// NOTE: this is not the amount in the currency, but the number of credits
InitialCreditsToLoad decimal.Decimal `json:"initial_credits_to_load,omitempty" default:"0" swaggertype:"string"`
// initial_credits_to_load_expiry_date YYYYMMDD format in UTC timezone (optional to set nil means no expiry)
// for ex 20250101 means the credits will expire on 2025-01-01 00:00:00 UTC
// hence they will be available for use until 2024-12-31 23:59:59 UTC
InitialCreditsToLoadExpiryDate *int `json:"initial_credits_to_load_expiry_date,omitempty"`
// initial_credits_expiry_date_utc is the expiry date in UTC timezone (optional to set nil means no expiry)
// ex 2025-01-01 00:00:00 UTC
InitialCreditsExpiryDateUTC *time.Time `json:"initial_credits_expiry_date_utc,omitempty"`
// alert_enabled is the flag to enable alerts for the wallet
// defaults to true, can be explicitly set to false to disable alerts
AlertEnabled bool `json:"alert_enabled,omitempty"`
// alert_config is the alert configuration for the wallet (optional)
AlertConfig *AlertConfig `json:"alert_config,omitempty"`
// auto top-up object
AutoTopup *types.AutoTopup `json:"auto_topup,omitempty"`
// price_unit is the code of the price unit to use for wallet creation
// If provided, the price unit will be used to set the currency and conversion rate of the wallet:
// - currency: set to price unit's base_currency
// - conversion_rate: set to price unit's conversion_rate
PriceUnit *string `json:"price_unit,omitempty"`
}
CreateWalletRequest represents the request to create a wallet
func (*CreateWalletRequest) ToWallet ¶
func (r *CreateWalletRequest) ToWallet(ctx context.Context) *wallet.Wallet
ToWallet converts a create wallet request to a wallet
func (*CreateWalletRequest) Validate ¶
func (r *CreateWalletRequest) Validate() error
type CreditGrantApplicationResponse ¶ added in v1.0.38
type CreditGrantApplicationResponse struct {
*domainCreditGrantApplication.CreditGrantApplication
}
CreditGrantApplicationResponse represents the response for a credit grant application
type CreditGrantResponse ¶ added in v1.0.18
type CreditGrantResponse struct {
*creditgrant.CreditGrant
}
CreditGrantResponse represents the response for a credit grant
func FromCreditGrant ¶ added in v1.0.18
func FromCreditGrant(grant *creditgrant.CreditGrant) *CreditGrantResponse
FromCreditGrant converts domain CreditGrant to CreditGrantResponse
type CreditNoteResponse ¶ added in v1.0.18
type CreditNoteResponse struct {
*creditnote.CreditNote
// invoice contains the associated invoice information if requested
Invoice *InvoiceResponse `json:"invoice,omitempty"`
// subscription contains the associated subscription information if applicable
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
// customer contains the customer information associated with this credit note
Customer *customer.Customer `json:"customer,omitempty"`
}
CreditNoteResponse represents the response payload containing credit note information
type CurrencyRevenueWindows ¶ added in v1.0.60
type CurrencyRevenueWindows struct {
Windows []types.RevenueWindow `json:"windows"`
}
CurrencyRevenueWindows represents windows for a specific currency
type CustomerEntitlementsResponse ¶ added in v1.0.0
type CustomerEntitlementsResponse struct {
CustomerID string `json:"customer_id"`
Features []*AggregatedFeature `json:"features"`
}
CustomerEntitlementsResponse represents the response for customer entitlements
type CustomerInvoiceSummary ¶
type CustomerInvoiceSummary struct {
// customer_id is the unique identifier of the customer
CustomerID string `json:"customer_id"`
// currency is the three-letter ISO currency code for this summary
Currency string `json:"currency"`
// total_revenue_amount is the total revenue generated from this customer in this currency
TotalRevenueAmount decimal.Decimal `json:"total_revenue_amount" swaggertype:"string"`
// total_unpaid_amount is the total amount of unpaid invoices in this currency
TotalUnpaidAmount decimal.Decimal `json:"total_unpaid_amount" swaggertype:"string"`
// total_overdue_amount is the total amount of overdue invoices in this currency
TotalOverdueAmount decimal.Decimal `json:"total_overdue_amount" swaggertype:"string"`
// total_invoice_count is the total number of invoices for this customer in this currency
TotalInvoiceCount int `json:"total_invoice_count"`
// unpaid_invoice_count is the number of unpaid invoices for this customer in this currency
UnpaidInvoiceCount int `json:"unpaid_invoice_count"`
// overdue_invoice_count is the number of overdue invoices for this customer in this currency
OverdueInvoiceCount int `json:"overdue_invoice_count"`
// unpaid_usage_charges is the total amount of unpaid usage-based charges in this currency
UnpaidUsageCharges decimal.Decimal `json:"unpaid_usage_charges" swaggertype:"string"`
// unpaid_fixed_charges is the total amount of unpaid fixed charges in this currency
UnpaidFixedCharges decimal.Decimal `json:"unpaid_fixed_charges" swaggertype:"string"`
}
CustomerInvoiceSummary represents a summary of customer's invoice status for a specific currency
type CustomerMultiCurrencyInvoiceSummary ¶
type CustomerMultiCurrencyInvoiceSummary struct {
// customer_id is the unique identifier of the customer
CustomerID string `json:"customer_id"`
// default_currency is the primary currency for this customer
DefaultCurrency string `json:"default_currency"`
// summaries contains the invoice summaries for each currency
Summaries []*CustomerInvoiceSummary `json:"summaries"`
}
CustomerMultiCurrencyInvoiceSummary represents invoice summaries across all currencies for a customer
type CustomerResponse ¶
type CustomerResponse struct {
*customer.Customer
ParentCustomer *CustomerResponse `json:"parent_customer,omitempty"`
}
CustomerResponse represents the response for customer operations @Description Customer response object containing all customer information
type CustomerUsageSummaryResponse ¶ added in v1.0.0
type CustomerUsageSummaryResponse struct {
CustomerID string `json:"customer_id"`
Features []*FeatureUsageSummary `json:"features"`
Period *BillingPeriodInfo `json:"period"`
Pagination *types.PaginationResponse `json:"pagination,omitempty"`
}
CustomerUsageSummaryResponse represents the response for customer usage summary
type DashboardRevenuesRequest ¶ added in v1.0.60
type DashboardRevenuesRequest struct {
RevenueTrend *RevenueTrendRequest `json:"revenue_trend,omitempty"`
}
DashboardRevenuesRequest represents the request for dashboard revenues API
func (*DashboardRevenuesRequest) Validate ¶ added in v1.0.60
func (r *DashboardRevenuesRequest) Validate() error
Validate validates the dashboard revenues request
type DashboardRevenuesResponse ¶ added in v1.0.60
type DashboardRevenuesResponse struct {
RevenueTrend *RevenueTrendResponse `json:"revenue_trend,omitempty"`
RecentSubscriptions *RecentSubscriptionsResponse `json:"recent_subscriptions,omitempty"`
InvoicePaymentStatus *InvoicePaymentStatusResponse `json:"invoice_payment_status,omitempty"`
}
DashboardRevenuesResponse represents the response for dashboard revenues API
type DeleteCostsheetResponse ¶ added in v1.0.33
DeleteCostsheetResponse represents the response for deleting a costsheet
type DeletePriceRequest ¶ added in v1.0.23
func (*DeletePriceRequest) Validate ¶ added in v1.0.23
func (r *DeletePriceRequest) Validate() error
type DeleteSubscriptionLineItemRequest ¶ added in v1.0.23
type DeleteSubscriptionLineItemRequest struct {
EffectiveFrom *time.Time `json:"effective_from,omitempty"`
}
DeleteSubscriptionLineItemRequest represents the request to delete a subscription line item
func (*DeleteSubscriptionLineItemRequest) Validate ¶ added in v1.0.23
func (r *DeleteSubscriptionLineItemRequest) Validate() error
Validate validates the delete subscription line item request
type DiscountResult ¶ added in v1.0.38
type DiscountResult struct {
Discount decimal.Decimal // The discount amount applied
FinalPrice decimal.Decimal // The final price after discount
}
DiscountResult holds the result of applying a discount
type EntitlementResponse ¶
type EntitlementResponse struct {
*entitlement.Entitlement
Feature *FeatureResponse `json:"feature,omitempty"`
Plan *PlanResponse `json:"plan,omitempty"`
Addon *AddonResponse `json:"addon,omitempty"`
// TODO: Remove this once we have a proper entitlement entity type
PlanID string `json:"plan_id,omitempty"`
}
EntitlementResponse represents the response for an entitlement
func EntitlementToResponse ¶
func EntitlementToResponse(e *entitlement.Entitlement) *EntitlementResponse
EntitlementToResponse converts an entitlement to a response
func EntitlementsToResponse ¶
func EntitlementsToResponse(entitlements []*entitlement.Entitlement) []*EntitlementResponse
EntitlementsToResponse converts a slice of entitlements to responses
type EntitlementSource ¶ added in v1.0.0
type EntitlementSource struct {
SubscriptionID string `json:"subscription_id"`
EntityID string `json:"entity_id"`
EntityType EntitlementSourceEntityType `json:"entity_type"`
Quantity int64 `json:"quantity"`
EntityName string `json:"entity_name"`
EntitlementID string `json:"entitlement_id"`
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit,omitempty"`
StaticValue string `json:"static_value,omitempty"`
UsageResetPeriod types.BillingPeriod `json:"usage_reset_period,omitempty"`
}
EntitlementSource tracks which subscription provided the entitlement
type EntitlementSourceEntityType ¶ added in v1.0.21
type EntitlementSourceEntityType string
EntitlementSourceType defines the type of entitlement source
const ( EntitlementSourceEntityTypePlan EntitlementSourceEntityType = "plan" EntitlementSourceEntityTypeAddon EntitlementSourceEntityType = "addon" EntitlementSourceEntityTypeSubscription EntitlementSourceEntityType = "subscription" )
func (EntitlementSourceEntityType) Validate ¶ added in v1.0.21
func (e EntitlementSourceEntityType) Validate() error
type EntityIntegrationMappingResponse ¶ added in v1.0.21
type EntityIntegrationMappingResponse struct {
ID string `json:"id"`
EntityID string `json:"entity_id"`
EntityType types.IntegrationEntityType `json:"entity_type"`
ProviderType string `json:"provider_type"`
ProviderEntityID string `json:"provider_entity_id"`
EnvironmentID string `json:"environment_id"`
TenantID string `json:"tenant_id"`
Status types.Status `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
type EnvironmentResponse ¶
type EnvironmentResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func NewEnvironmentResponse ¶
func NewEnvironmentResponse(e *environment.Environment) *EnvironmentResponse
type Event ¶
type Event struct {
ID string `json:"id"`
ExternalCustomerID string `json:"external_customer_id"`
CustomerID string `json:"customer_id"`
EventName string `json:"event_name"`
Timestamp time.Time `json:"timestamp"`
Properties map[string]interface{} `json:"properties"`
Source string `json:"source"`
EnvironmentID string `json:"environment_id"`
}
type EventCostInfo ¶ added in v1.0.38
type EventCountPoint ¶ added in v1.0.42
type ExpiredCreditsResponse ¶
type ExpiredCreditsResponse struct {
Items []*ExpiredCreditsResponseItem `json:"items"`
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
}
type ExportRequest ¶ added in v1.0.32
type ExportRequest struct {
EntityType types.ScheduledTaskEntityType `json:"entity_type"`
ConnectionID string `json:"connection_id"` // Connection ID for S3 credentials
TenantID string `json:"tenant_id"`
EnvID string `json:"env_id"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
JobConfig *types.S3JobConfig `json:"job_config"` // S3 job configuration from scheduled_tasks
}
ExportRequest represents an export request
type ExportResponse ¶ added in v1.0.32
type ExportResponse struct {
EntityType types.ScheduledTaskEntityType `json:"entity_type"`
RecordCount int `json:"record_count"`
FileURL string `json:"file_url"`
FileSizeBytes int64 `json:"file_size_bytes"`
ExportedAt time.Time `json:"exported_at"`
}
ExportResponse represents the result of an export operation
type FeatureResponse ¶
type FeatureResponse struct {
*feature.Feature
Meter *MeterResponse `json:"meter,omitempty"`
}
type FeatureUsageSummary ¶ added in v1.0.0
type FeatureUsageSummary struct {
Feature *FeatureResponse `json:"feature"`
TotalLimit *int64 `json:"total_limit"`
IsUnlimited bool `json:"is_unlimited"`
CurrentUsage decimal.Decimal `json:"current_usage" swaggertype:"string"`
UsagePercent decimal.Decimal `json:"usage_percent" swaggertype:"string"`
IsEnabled bool `json:"is_enabled"`
IsSoftLimit bool `json:"is_soft_limit"`
NextUsageResetAt *time.Time `json:"next_usage_reset_at"`
Sources []*EntitlementSource `json:"sources"`
}
FeatureUsageSummary represents usage for a single feature
type GatewayInfo ¶ added in v1.0.21
type GatewayInfo struct {
Type types.PaymentGatewayType `json:"type"`
Name string `json:"name"`
IsActive bool `json:"is_active"`
IsPreferred bool `json:"is_preferred"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
GatewayInfo represents information about a payment gateway
type GenericPaymentStatusResponse ¶ added in v1.0.21
type GenericPaymentStatusResponse struct {
SessionID string `json:"session_id"`
PaymentIntentID string `json:"payment_intent_id,omitempty"`
Status string `json:"status"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CustomerID string `json:"customer_id,omitempty"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Gateway string `json:"gateway"`
}
GenericPaymentStatusResponse represents a generic payment status response
type GetActiveAddonAssociationRequest ¶ added in v1.0.35
type GetActiveAddonAssociationRequest struct {
AddonIds []string `json:"addon_ids,omitempty"`
EntityID string `json:"entity_id" validate:"required"`
EntityType types.AddonAssociationEntityType `json:"entity_type" validate:"required"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
}
GetActiveAddonAssociationRequest represents the request to get active addon associations
func (*GetActiveAddonAssociationRequest) Validate ¶ added in v1.0.35
func (r *GetActiveAddonAssociationRequest) Validate() error
type GetCostAnalyticsRequest ¶ added in v1.0.33
type GetCostAnalyticsRequest struct {
// Time range fields (optional - defaults to last 7 days if not provided)
StartTime time.Time `json:"start_time,omitempty"`
EndTime time.Time `json:"end_time,omitempty"`
ExternalCustomerID string `json:"external_customer_id,omitempty"` // Optional - for specific customer
// Additional filters
FeatureIDs []string `json:"feature_ids,omitempty"`
// Expand options - specify which entities to expand
Expand []string `json:"expand,omitempty"` // "meter", "price"
// Pagination
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
GetCostAnalyticsRequest represents the request to get cost analytics
func (*GetCostAnalyticsRequest) Validate ¶ added in v1.0.33
func (r *GetCostAnalyticsRequest) Validate() error
Validate validates the cost analytics request and sets defaults
type GetCostAnalyticsResponse ¶ added in v1.0.33
type GetCostAnalyticsResponse struct {
CustomerID string `json:"customer_id,omitempty"`
ExternalCustomerID string `json:"external_customer_id,omitempty"`
CostsheetID string `json:"costsheet_id,omitempty"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Currency string `json:"currency"`
// Summary
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
TotalQuantity decimal.Decimal `json:"total_quantity" swaggertype:"string"`
TotalEvents int64 `json:"total_events"`
// Detailed breakdown
CostAnalytics []CostAnalyticItem `json:"cost_analytics"`
// Time-series (if requested)
CostTimeSeries []CostPoint `json:"cost_time_series,omitempty"`
// Pagination
Pagination *types.PaginationResponse `json:"pagination,omitempty"`
}
GetCostAnalyticsResponse represents the response for cost analytics
type GetCostBreakdownRequest ¶ added in v1.0.18
type GetCostBreakdownRequest struct {
// SubscriptionID to get the time period from if StartTime and EndTime are not provided
SubscriptionID string `json:"subscription_id" validate:"required"`
// Optional time range. If not provided, uses subscription period
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
}
GetCostBreakdownRequest represents the request to calculate costs for a time period.
type GetCostsheetResponse ¶ added in v1.0.33
type GetCostsheetResponse struct {
Costsheet *CostsheetResponse `json:"costsheet"`
}
GetCostsheetResponse represents the response for getting a single costsheet
type GetCustomerEntitlementsRequest ¶ added in v1.0.0
type GetCustomerEntitlementsRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" form:"feature_ids"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
}
GetCustomerEntitlementsRequest represents the request for getting customer entitlements
func (*GetCustomerEntitlementsRequest) Validate ¶ added in v1.0.0
func (r *GetCustomerEntitlementsRequest) Validate() error
type GetCustomerPaymentMethodsRequest ¶ added in v1.0.22
type GetCustomerPaymentMethodsRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
}
GetCustomerPaymentMethodsRequest represents a request to get customer payment methods
type GetCustomerUsageSummaryRequest ¶ added in v1.0.0
type GetCustomerUsageSummaryRequest struct {
CustomerID string `json:"customer_id,omitempty" form:"customer_id"`
CustomerLookupKey string `json:"customer_lookup_key,omitempty" form:"customer_lookup_key"`
FeatureIDs []string `json:"feature_ids,omitempty" form:"feature_ids"`
FeatureLookupKeys []string `json:"feature_lookup_keys,omitempty" form:"feature_lookup_keys"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
}
GetCustomerUsageSummaryRequest represents the request for getting customer usage summary
func (*GetCustomerUsageSummaryRequest) Validate ¶ added in v1.0.0
func (r *GetCustomerUsageSummaryRequest) Validate() error
type GetCustomerWalletsRequest ¶ added in v1.0.17
type GetCustomerWalletsRequest struct {
ID string `form:"id"`
LookupKey string `form:"lookup_key"`
IncludeRealTimeBalance bool `form:"include_real_time_balance" default:"false"`
Expand string `form:"expand"`
}
func (*GetCustomerWalletsRequest) Validate ¶ added in v1.0.17
func (r *GetCustomerWalletsRequest) Validate() error
type GetDefaultPaymentMethodRequest ¶ added in v1.0.22
type GetDefaultPaymentMethodRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
}
GetDefaultPaymentMethodRequest represents a request to get default payment method
type GetDetailedCostAnalyticsResponse ¶ added in v1.0.33
type GetDetailedCostAnalyticsResponse struct {
// Cost analytics array (flattened from nested structure)
CostAnalytics []CostAnalyticItem `json:"cost_analytics"`
// Derived metrics
TotalRevenue decimal.Decimal `json:"total_revenue" swaggertype:"string"`
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
Margin decimal.Decimal `json:"margin" swaggertype:"string"` // Revenue - Cost
MarginPercent decimal.Decimal `json:"margin_percent" swaggertype:"string"` // (Margin / Revenue) * 100
ROI decimal.Decimal `json:"roi" swaggertype:"string"` // (Revenue - Cost) / Cost
ROIPercent decimal.Decimal `json:"roi_percent" swaggertype:"string"` // ROI * 100
Currency string `json:"currency"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
GetCombinedAnalyticsResponse represents the response for combined cost and revenue analytics
type GetEventsRequest ¶
type GetEventsRequest struct {
// Customer ID in your system that was sent with the event
ExternalCustomerID string `json:"external_customer_id"`
// Event name / Unique identifier for the event in your system
EventName string `json:"event_name"`
// Event ID is the idempotency key for the event
EventID string `json:"event_id"`
// Start time of the events to be fetched in ISO 8601 format
// Defaults to last 7 days from now if not provided
StartTime time.Time `json:"start_time" example:"2024-11-09T00:00:00Z"`
// End time of the events to be fetched in ISO 8601 format
// Defaults to now if not provided
EndTime time.Time `json:"end_time" example:"2024-12-09T00:00:00Z"`
// First key to iterate over the events
IterFirstKey string `json:"iter_first_key"`
// Last key to iterate over the events
IterLastKey string `json:"iter_last_key"`
// Property filters to filter the events by the keys in `properties` field of the event
PropertyFilters map[string][]string `json:"property_filters,omitempty"`
// Page size to fetch the events and is set to 50 by default
PageSize int `json:"page_size"`
// Offset to fetch the events and is set to 0 by default
Offset int `json:"offset"`
// Source to filter the events by the source
Source string `json:"source"`
// Sort by the field. Allowed values (case sensitive): timestamp, event_name (default: timestamp)
Sort *string `json:"sort,omitempty" form:"sort" example:"timestamp"`
// Order by condition. Allowed values (case sensitive): asc, desc (default: desc)
Order *string `json:"order,omitempty" form:"order" example:"desc"`
// Count of total number of events
CountTotal bool `json:"-"`
}
func (*GetEventsRequest) Validate ¶
func (r *GetEventsRequest) Validate() error
type GetEventsResponse ¶
type GetHuggingFaceBillingDataRequest ¶ added in v1.0.38
type GetHuggingFaceBillingDataRequest struct {
EventIDs []string `json:"requestIds" binding:"required,min=1"`
}
type GetHuggingFaceBillingDataResponse ¶ added in v1.0.38
type GetHuggingFaceBillingDataResponse struct {
Data []EventCostInfo `json:"requests"`
}
type GetInvoiceWithBreakdownRequest ¶ added in v1.0.35
type GetInvoiceWithBreakdownRequest struct {
// ID is the unique identifier of the invoice
ID string `json:"id" validate:"required"`
// GroupBy contains the grouping parameters for flexible usage breakdown
GroupBy []string `json:"group_by,omitempty"`
// Force Runtime recalculation of usage breakdown
ForceRuntimeRecalculation bool `json:"force_runtime_recalculation,omitempty" default:"false"`
}
GetInvoiceWithBreakdownRequest represents the request for getting an invoice with breakdown
func (*GetInvoiceWithBreakdownRequest) Validate ¶ added in v1.0.35
func (r *GetInvoiceWithBreakdownRequest) Validate() error
type GetMonitoringDataRequest ¶ added in v1.0.36
type GetMonitoringDataRequest struct {
StartTime time.Time `json:"start_time,omitempty" form:"start_time"`
EndTime time.Time `json:"end_time,omitempty" form:"end_time"`
WindowSize types.WindowSize `json:"window_size,omitempty" form:"window_size"`
}
func (*GetMonitoringDataRequest) Validate ¶ added in v1.0.36
func (r *GetMonitoringDataRequest) Validate() error
type GetMonitoringDataResponse ¶ added in v1.0.36
type GetMonitoringDataResponse struct {
TotalCount uint64 `json:"total_count"`
ConsumptionLag int64 `json:"consumption_lag"`
PostProcessingLag int64 `json:"post_processing_lag"`
Points []EventCountPoint `json:"points,omitempty"`
}
type GetPendingSchedulesResponse ¶ added in v1.0.60
type GetPendingSchedulesResponse struct {
// schedules is the list of pending schedules
Schedules []*SubscriptionScheduleResponse `json:"schedules"`
// count is the number of pending schedules
Count int `json:"count"`
}
GetPendingSchedulesResponse represents a list of pending schedules @Description List of pending schedules for a subscription
type GetPreviewInvoiceRequest ¶
type GetPreviewInvoiceRequest struct {
// subscription_id is the unique identifier of the subscription to preview invoice for
SubscriptionID string `json:"subscription_id" binding:"required"`
// period_start is the optional start date of the period to preview
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end is the optional end date of the period to preview
PeriodEnd *time.Time `json:"period_end,omitempty"`
}
GetPreviewInvoiceRequest represents the request payload for previewing an invoice
type GetPricesByPlanRequest ¶ added in v1.0.35
type GetPricesByPlanRequest struct {
PlanID string `json:"plan_id" validate:"required"`
AllowExpired bool `json:"allow_expired,omitempty"`
}
func (*GetPricesByPlanRequest) Validate ¶ added in v1.0.35
func (r *GetPricesByPlanRequest) Validate() error
type GetSubscriptionEntitlementsRequest ¶ added in v1.0.35
type GetSubscriptionEntitlementsRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" form:"feature_ids"`
}
GetSubscriptionEntitlementsRequest represents the request for getting subscription entitlements
func (*GetSubscriptionEntitlementsRequest) Validate ¶ added in v1.0.35
func (r *GetSubscriptionEntitlementsRequest) Validate() error
type GetSupportedGatewaysResponse ¶ added in v1.0.21
type GetSupportedGatewaysResponse struct {
Gateways []GatewayInfo `json:"gateways"`
}
GetSupportedGatewaysResponse represents the list of supported gateways
type GetUnpaidInvoicesToBePaidRequest ¶ added in v1.0.42
type GetUnpaidInvoicesToBePaidRequest struct {
// customer_id is the unique identifier of the customer
CustomerID string `json:"customer_id" validate:"required"`
// currency is the three-letter ISO currency code for this request
Currency string `json:"currency" validate:"required"`
}
func (*GetUnpaidInvoicesToBePaidRequest) Validate ¶ added in v1.0.42
func (r *GetUnpaidInvoicesToBePaidRequest) Validate() error
type GetUnpaidInvoicesToBePaidResponse ¶ added in v1.0.42
type GetUnpaidInvoicesToBePaidResponse struct {
// invoices is the list of unpaid invoices to be paid
Invoices []*InvoiceResponse `json:"invoices"`
// total_unpaid_amount is the total amount of unpaid invoices to be paid
TotalUnpaidAmount decimal.Decimal `json:"total_unpaid_amount" swaggertype:"string"`
// total_unpaid_usage_charges is the total amount of unpaid usage charges to be paid
TotalUnpaidUsageCharges decimal.Decimal `json:"total_unpaid_usage_charges" swaggertype:"string"`
// total_unpaid_fixed_charges is the total amount of unpaid fixed charges to be paid
TotalUnpaidFixedCharges decimal.Decimal `json:"total_unpaid_fixed_charges" swaggertype:"string"`
}
type GetUpcomingCreditGrantApplicationsRequest ¶ added in v1.0.38
type GetUpcomingCreditGrantApplicationsRequest struct {
// SubscriptionIDs is a list of subscription IDs to get upcoming credit grant applications for
// This allows querying multiple subscriptions at once, useful for customer-level queries
SubscriptionIDs []string `json:"subscription_ids" binding:"required,min=1" validate:"required,min=1"`
}
GetUpcomingCreditGrantApplicationsRequest represents the request to get upcoming credit grant applications
func (*GetUpcomingCreditGrantApplicationsRequest) Validate ¶ added in v1.0.38
func (r *GetUpcomingCreditGrantApplicationsRequest) Validate() error
Validate validates the GetUpcomingCreditGrantApplicationsRequest
type GetUsageAnalyticsRequest ¶ added in v1.0.17
type GetUsageAnalyticsRequest struct {
ExternalCustomerID string `json:"external_customer_id" binding:"required"`
FeatureIDs []string `json:"feature_ids,omitempty"`
Sources []string `json:"sources,omitempty"`
StartTime time.Time `json:"start_time,omitempty"`
EndTime time.Time `json:"end_time,omitempty"`
GroupBy []string `json:"group_by,omitempty"` // allowed values: "source", "feature_id", "properties.<field_name>"
WindowSize types.WindowSize `json:"window_size,omitempty"`
Expand []string `json:"expand,omitempty"` // allowed values: "price", "meter", "feature", "subscription_line_item","plan","addon"
// Property filters to filter the events by the keys in `properties` field of the event
PropertyFilters map[string][]string `json:"property_filters,omitempty"`
}
type GetUsageAnalyticsResponse ¶ added in v1.0.17
type GetUsageAnalyticsResponse struct {
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
Currency string `json:"currency"`
Items []UsageAnalyticItem `json:"items"`
}
GetUsageAnalyticsResponse represents the response for the usage analytics API
type GetUsageByMeterRequest ¶
type GetUsageByMeterRequest struct {
MeterID string `form:"meter_id" json:"meter_id" binding:"required" example:"123"`
PriceID string `form:"-" json:"-"` // this is just for internal use to store the price id
Meter *meter.Meter `form:"-" json:"-"` // caller can set this in case already fetched from db to avoid extra db call
ExternalCustomerID string `form:"external_customer_id" json:"external_customer_id" example:"user_5"`
CustomerID string `form:"customer_id" json:"customer_id" example:"customer456"`
StartTime time.Time `form:"start_time" json:"start_time" example:"2024-11-09T00:00:00Z"`
EndTime time.Time `form:"end_time" json:"end_time" example:"2024-12-09T00:00:00Z"`
WindowSize types.WindowSize `form:"window_size" json:"window_size"`
BucketSize types.WindowSize `form:"bucket_size" json:"bucket_size,omitempty" example:"HOUR"` // Optional, only used for MAX aggregation with windowing
Filters map[string][]string `form:"filters,omitempty" json:"filters,omitempty"`
// BillingAnchor enables custom monthly billing periods for meter usage aggregation.
//
// Usage guidelines:
// - Only effective when WindowSize = "MONTH"
// - For other window sizes (DAY, HOUR, WEEK), this field is ignored
// - When nil, uses standard calendar months (1st to 1st)
// - When provided, creates custom monthly periods (e.g., 5th to 5th)
//
// Common use cases:
// - Subscription billing periods that don't align with calendar months
// - Customer-specific billing cycles (e.g., signed up on 15th)
// - Multi-tenant systems with different billing anchor dates
//
// Example: If BillingAnchor = "2024-03-05T14:30:45Z" and WindowSize = "MONTH":
// - March period: 2024-03-05 14:30:45 to 2024-04-05 14:30:45
// - April period: 2024-04-05 14:30:45 to 2024-05-05 14:30:45
BillingAnchor *time.Time `form:"billing_anchor" json:"billing_anchor,omitempty" example:"2024-03-05T14:30:45Z"`
}
func (*GetUsageByMeterRequest) Validate ¶
func (r *GetUsageByMeterRequest) Validate() error
type GetUsageBySubscriptionRequest ¶
type GetUsageBySubscriptionRequest struct {
SubscriptionID string `json:"subscription_id" binding:"required" example:"123"`
StartTime time.Time `json:"start_time" example:"2024-03-13T00:00:00Z"`
EndTime time.Time `json:"end_time" example:"2024-03-20T00:00:00Z"`
LifetimeUsage bool `json:"lifetime_usage" example:"false"`
}
type GetUsageBySubscriptionResponse ¶
type GetUsageBySubscriptionResponse struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
DisplayAmount string `json:"display_amount"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Charges []*SubscriptionUsageByMetersResponse `json:"charges"`
CommitmentAmount float64 `json:"commitment_amount,omitempty"`
OverageFactor float64 `json:"overage_factor,omitempty"`
CommitmentUtilized float64 `json:"commitment_utilized,omitempty"` // Amount of commitment used
OverageAmount float64 `json:"overage_amount,omitempty"` // Amount charged at overage rate
HasOverage bool `json:"has_overage"` // Whether any usage exceeded commitment
}
type GetUsageRequest ¶
type GetUsageRequest struct {
ExternalCustomerID string `form:"external_customer_id" json:"external_customer_id" example:"customer456"`
CustomerID string `form:"customer_id" json:"customer_id" example:"customer456"`
EventName string `form:"event_name" json:"event_name" binding:"required" required:"true" example:"api_request"`
PropertyName string `form:"property_name" json:"property_name" example:"request_size"` // will be empty/ignored in case of COUNT
AggregationType types.AggregationType `form:"aggregation_type" json:"aggregation_type" binding:"required"`
StartTime time.Time `form:"start_time" json:"start_time" example:"2024-03-13T00:00:00Z"`
EndTime time.Time `form:"end_time" json:"end_time" example:"2024-03-20T00:00:00Z"`
WindowSize types.WindowSize `form:"window_size" json:"window_size"`
BucketSize types.WindowSize `form:"bucket_size" json:"bucket_size,omitempty" example:"HOUR"` // Optional, only used for MAX aggregation with windowing
Filters map[string][]string `form:"filters,omitempty" json:"filters,omitempty"`
PriceID string `form:"-" json:"-"` // this is just for internal use to store the price id
MeterID string `form:"-" json:"-"` // this is just for internal use to store the meter id
Multiplier *decimal.Decimal `form:"multiplier" json:"multiplier,omitempty" swaggertype:"string"`
// BillingAnchor enables custom monthly billing periods for usage aggregation.
//
// When to use:
// - WindowSize = "MONTH" AND you need custom monthly periods (not calendar months)
// - Subscription billing that doesn't align with calendar months
// - Example: Customer signed up on 15th, so billing periods are 15th to 15th
//
// When NOT to use:
// - WindowSize != "MONTH" (ignored for DAY, HOUR, WEEK, etc.)
// - Standard calendar-based billing (1st to 1st of each month)
//
// Example values:
// - "2024-03-05T14:30:45.123456789Z" (5th of each month at 2:30:45 PM)
// - "2024-01-15T00:00:00Z" (15th of each month at midnight)
// - "2024-02-29T12:00:00Z" (29th of each month at noon - handles leap years)
BillingAnchor *time.Time `form:"billing_anchor" json:"billing_anchor,omitempty" example:"2024-03-05T14:30:45.123456789Z"`
}
func (*GetUsageRequest) ToUsageParams ¶
func (r *GetUsageRequest) ToUsageParams() *events.UsageParams
func (*GetUsageRequest) Validate ¶
func (r *GetUsageRequest) Validate() error
type GetUsageResponse ¶
type GetUsageResponse struct {
Results []UsageResult `json:"results,omitempty"`
Value float64 `json:"value,omitempty"`
EventName string `json:"event_name"`
Type types.AggregationType `json:"type"`
}
func FromAggregationResult ¶
func FromAggregationResult(result *events.AggregationResult) *GetUsageResponse
type GroupResponse ¶ added in v1.0.34
type GroupResponse struct {
ID string `json:"id"`
Name string `json:"name"`
LookupKey string `json:"lookup_key"`
EntityType string `json:"entity_type"`
EntityIDs []string `json:"entity_ids"`
Status string `json:"status"`
Metadata map[string]string `json:"metadata"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
GroupResponse represents the group response
func ToGroupResponse ¶ added in v1.0.34
func ToGroupResponse(group *group.Group) *GroupResponse
func ToGroupResponseWithEntities ¶ added in v1.0.34
func ToGroupResponseWithEntities(group *group.Group, entityIDs []string) *GroupResponse
type IngestEventRequest ¶
type IngestEventRequest struct {
EventName string `json:"event_name" validate:"required" binding:"required" example:"api_request" csv:"event_name"`
EventID string `json:"event_id" example:"event123" csv:"event_id"`
CustomerID string `json:"customer_id" example:"customer456" csv:"customer_id"`
ExternalCustomerID string `json:"external_customer_id" validate:"required" binding:"required" example:"customer456" csv:"external_customer_id"`
Timestamp time.Time `json:"timestamp" example:"2024-03-20T15:04:05Z" csv:"-"` // Handled separately due to parsing
TimestampStr string `json:"-" csv:"timestamp"` // Used for CSV parsing
Source string `json:"source" example:"api" csv:"source"`
Properties map[string]interface{} `json:"properties" swaggertype:"object,string,number" example:"{\"request_size\":100,\"response_status\":200}" csv:"-"` // Handled separately for dynamic columns
}
func (*IngestEventRequest) ToEvent ¶ added in v1.0.0
func (r *IngestEventRequest) ToEvent(ctx context.Context) *events.Event
func (*IngestEventRequest) Validate ¶
func (r *IngestEventRequest) Validate() error
type InitiateOAuthRequest ¶ added in v1.0.47
type InitiateOAuthRequest struct {
Provider types.OAuthProvider `json:"provider" binding:"required"` // e.g., "quickbooks"
Name string `json:"name" binding:"required"` // Connection name
Credentials map[string]string `json:"credentials" binding:"required"` // Provider-specific credentials (all required for the provider)
Metadata map[string]string `json:"metadata" binding:"required"` // Provider-specific metadata (all required for the provider)
SyncConfig *types.SyncConfig `json:"sync_config"` // Optional sync configuration for the connection
}
InitiateOAuthRequest represents a generic request to initiate OAuth for any provider
func (*InitiateOAuthRequest) Validate ¶ added in v1.0.47
func (r *InitiateOAuthRequest) Validate() error
Validate validates the OAuth init request with provider-specific rules
type InitiateOAuthResponse ¶ added in v1.0.47
type InitiateOAuthResponse struct {
OAuthURL string `json:"oauth_url"`
SessionID string `json:"session_id"`
}
InitiateOAuthResponse represents the response from initiating OAuth
type IntegrationEntityMapping ¶ added in v1.0.22
type IntegrationEntityMapping struct {
// provider is the integration provider name (e.g., "stripe", "razorpay")
Provider string `json:"provider" validate:"required,oneof=stripe razorpay paypal"`
// id is the external entity ID from the provider
ID string `json:"id" validate:"required"`
}
IntegrationEntityMapping represents a provider integration mapping @Description Integration entity mapping for external provider systems
type InvoiceCoupon ¶ added in v1.0.21
type InvoiceCoupon struct {
CouponID string `json:"coupon_id" validate:"required"`
CouponAssociationID *string `json:"coupon_association_id,omitempty"`
}
InvoiceCoupon represents a coupon to be applied at the invoice level. Only coupon ID is needed - the service will fetch and validate the coupon.
func (*InvoiceCoupon) Validate ¶ added in v1.0.21
func (i *InvoiceCoupon) Validate() error
Validate validates the invoice coupon DTO
type InvoiceLineItemCoupon ¶ added in v1.0.21
type InvoiceLineItemCoupon struct {
LineItemID string `json:"line_item_id" validate:"required"` // price_id used to match the line item
CouponID string `json:"coupon_id" validate:"required"`
CouponAssociationID *string `json:"coupon_association_id,omitempty"`
}
InvoiceLineItemCoupon represents a coupon applied to a specific invoice line item. LineItemID is the price_id used to match the coupon to the correct line item. Only coupon ID is needed - the service will fetch and validate the coupon.
func (*InvoiceLineItemCoupon) Validate ¶ added in v1.0.21
func (c *InvoiceLineItemCoupon) Validate() error
Validate validates the line item coupon DTO
type InvoiceLineItemPreview ¶ added in v1.0.25
type InvoiceLineItemPreview struct {
// description of the line item
Description string `json:"description"`
// amount for this line item
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
// quantity for this line item
Quantity decimal.Decimal `json:"quantity" swaggertype:"string"`
// unit_price for this line item
UnitPrice decimal.Decimal `json:"unit_price" swaggertype:"string"`
// period_start for this line item (if applicable)
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end for this line item (if applicable)
PeriodEnd *time.Time `json:"period_end,omitempty"`
// is_proration indicates if this line item is a proration
IsProration bool `json:"is_proration"`
}
InvoiceLineItemPreview contains preview information for an invoice line item
type InvoiceLineItemResponse ¶
type InvoiceLineItemResponse struct {
// id is the unique identifier for this line item
ID string `json:"id"`
// invoice_id is the unique identifier of the invoice this line item belongs to
InvoiceID string `json:"invoice_id"`
// customer_id is the unique identifier of the customer associated with this line item
CustomerID string `json:"customer_id"`
// subscription_id is the optional unique identifier of the subscription associated with this line item
SubscriptionID *string `json:"subscription_id,omitempty"`
// price_id is the optional unique identifier of the price associated with this line item
PriceID *string `json:"price_id"`
// plan_id is the optional unique identifier of the plan associated with this line item
PlanID *string `json:"plan_id,omitempty"`
// entity_id is the optional unique identifier of the entity associated with this line item
EntityID *string `json:"entity_id,omitempty"`
// entity_type is the optional type of the entity associated with this line item
EntityType *string `json:"entity_type,omitempty"`
// plan_display_name is the optional human-readable name of the plan
PlanDisplayName *string `json:"plan_display_name,omitempty"`
// price_type indicates the type of pricing (fixed, usage, tiered, etc.)
PriceType *string `json:"price_type,omitempty"`
// meter_id is the optional unique identifier of the meter used for usage tracking
MeterID *string `json:"meter_id,omitempty"`
// meter_display_name is the optional human-readable name of the meter
MeterDisplayName *string `json:"meter_display_name,omitempty"`
// price_unit_id is the optional unique identifier of the price unit associated with this line item
PriceUnitID *string `json:"price_unit_id,omitempty"`
// price_unit is the optional 3-digit ISO code of the price unit associated with this line item
PriceUnit *string `json:"price_unit,omitempty"`
// price_unit_amount is the optional amount converted to the price unit currency
PriceUnitAmount *decimal.Decimal `json:"price_unit_amount,omitempty" swaggertype:"string"`
// display_name is the optional human-readable name for this line item
DisplayName *string `json:"display_name,omitempty"`
// amount is the monetary amount for this line item
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
// quantity is the quantity of units for this line item
Quantity decimal.Decimal `json:"quantity" swaggertype:"string"`
// currency is the three-letter ISO currency code for this line item
Currency string `json:"currency"`
// period_start is the optional start date of the period this line item covers
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end is the optional end date of the period this line item covers
PeriodEnd *time.Time `json:"period_end,omitempty"`
// metadata contains additional custom key-value pairs for storing extra information about this line item
Metadata types.Metadata `json:"metadata,omitempty"`
// tenant_id is the unique identifier of the tenant this line item belongs to
TenantID string `json:"tenant_id"`
// status represents the current status of this line item
Status string `json:"status"`
// created_at is the timestamp when this line item was created
CreatedAt time.Time `json:"created_at"`
// updated_at is the timestamp when this line item was last updated
UpdatedAt time.Time `json:"updated_at"`
// created_by is the identifier of the user who created this line item
CreatedBy string `json:"created_by,omitempty"`
// updated_by is the identifier of the user who last updated this line item
UpdatedBy string `json:"updated_by,omitempty"`
// usage_analytics contains usage analytics for this line item (legacy - grouped by source)
UsageAnalytics []SourceUsageItem `json:"usage_analytics,omitempty"`
// usage_breakdown contains flexible usage breakdown for this line item (supports any grouping)
UsageBreakdown []UsageBreakdownItem `json:"usage_breakdown,omitempty"`
// commitment_info contains details about any commitment applied to this line item
CommitmentInfo *types.CommitmentInfo `json:"commitment_info,omitempty"`
}
InvoiceLineItemResponse represents a line item in invoice response payloads
func NewInvoiceLineItemResponse ¶
func NewInvoiceLineItemResponse(item *invoice.InvoiceLineItem) *InvoiceLineItemResponse
type InvoicePaymentStatusResponse ¶ added in v1.0.60
type InvoicePaymentStatusResponse struct {
Paid int `json:"paid"` // Maps to InvoicePaymentStatus.Succeeded
Pending int `json:"pending"` // Maps to InvoicePaymentStatus.Pending
Failed int `json:"failed"` // Maps to InvoicePaymentStatus.Failed
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
}
InvoicePaymentStatusResponse represents invoice payment status counts Note: Paid field maps to types.InvoicePaymentStatus.Succeeded for API consistency
type InvoicePreview ¶ added in v1.0.25
type InvoicePreview struct {
// subtotal is the subtotal amount before taxes
Subtotal decimal.Decimal `json:"subtotal" swaggertype:"string"`
// tax_amount is the total tax amount
TaxAmount decimal.Decimal `json:"tax_amount" swaggertype:"string"`
// total is the total amount including taxes
Total decimal.Decimal `json:"total" swaggertype:"string"`
// currency is the currency for all amounts
Currency string `json:"currency"`
// line_items contains preview of line items
LineItems []InvoiceLineItemPreview `json:"line_items"`
// due_date is when the invoice would be due
DueDate *time.Time `json:"due_date,omitempty"`
}
InvoicePreview contains preview information for an invoice
type InvoiceResponse ¶
type InvoiceResponse struct {
// id is the unique identifier for this invoice
ID string `json:"id"`
// customer_id is the unique identifier of the customer this invoice belongs to
CustomerID string `json:"customer_id"`
// subscription_id is the optional unique identifier of the subscription associated with this invoice
SubscriptionID *string `json:"subscription_id,omitempty"`
// invoice_type indicates the type of invoice (subscription, one_time, etc.)
InvoiceType types.InvoiceType `json:"invoice_type"`
// invoice_status represents the current status of the invoice (draft, finalized, etc.)
InvoiceStatus types.InvoiceStatus `json:"invoice_status"`
// payment_status represents the payment status of the invoice (unpaid, paid, etc.)
PaymentStatus types.PaymentStatus `json:"payment_status"`
// currency is the three-letter ISO currency code (e.g., USD, EUR) for the invoice
Currency string `json:"currency"`
// amount_due is the total amount that needs to be paid for this invoice
AmountDue decimal.Decimal `json:"amount_due" swaggertype:"string"`
// total is the total amount of the invoice including taxes and discounts
Total decimal.Decimal `json:"total" swaggertype:"string"`
// total_discount is the total discount amount from coupon applications
TotalDiscount decimal.Decimal `json:"total_discount" swaggertype:"string"`
// subtotal is the amount before taxes and discounts are applied
Subtotal decimal.Decimal `json:"subtotal" swaggertype:"string"`
// amount_paid is the amount that has been paid towards this invoice
AmountPaid decimal.Decimal `json:"amount_paid" swaggertype:"string"`
// amount_remaining is the amount still outstanding on this invoice
AmountRemaining decimal.Decimal `json:"amount_remaining" swaggertype:"string"`
// overpaid_amount is the amount overpaid if payment_status is OVERPAID (amount_paid - total)
OverpaidAmount *decimal.Decimal `json:"overpaid_amount,omitempty" swaggertype:"string"`
// invoice_number is the optional human-readable identifier for the invoice
InvoiceNumber *string `json:"invoice_number,omitempty"`
// idempotency_key is the optional key used to prevent duplicate invoice creation
IdempotencyKey *string `json:"idempotency_key,omitempty"`
// billing_sequence is the optional sequence number for billing cycles
BillingSequence *int `json:"billing_sequence,omitempty"`
// description is the optional text description of the invoice
Description string `json:"description,omitempty"`
// due_date is the date by which payment is expected
DueDate *time.Time `json:"due_date,omitempty"`
// billing_period is the period this invoice covers (e.g., "monthly", "yearly")
BillingPeriod *string `json:"billing_period,omitempty"`
// period_start is the start date of the billing period
PeriodStart *time.Time `json:"period_start,omitempty"`
// period_end is the end date of the billing period
PeriodEnd *time.Time `json:"period_end,omitempty"`
// paid_at is the timestamp when this invoice was paid
PaidAt *time.Time `json:"paid_at,omitempty"`
// voided_at is the timestamp when this invoice was voided
VoidedAt *time.Time `json:"voided_at,omitempty"`
// finalized_at is the timestamp when this invoice was finalized
FinalizedAt *time.Time `json:"finalized_at,omitempty"`
// invoice_pdf_url is the optional URL to the PDF version of this invoice
InvoicePDFURL *string `json:"invoice_pdf_url,omitempty"`
// billing_reason indicates why this invoice was created (subscription_cycle, manual, etc.)
BillingReason string `json:"billing_reason,omitempty"`
// line_items contains the individual items that make up this invoice
LineItems []*InvoiceLineItemResponse `json:"line_items,omitempty"`
// metadata contains additional custom key-value pairs for storing extra information
Metadata types.Metadata `json:"metadata,omitempty"`
// version is the version number of this invoice
Version int `json:"version"`
// tenant_id is the unique identifier of the tenant this invoice belongs to
TenantID string `json:"tenant_id"`
// status represents the current status of this invoice
Status string `json:"status"`
// created_at is the timestamp when this invoice was created
CreatedAt time.Time `json:"created_at"`
// updated_at is the timestamp when this invoice was last updated
UpdatedAt time.Time `json:"updated_at"`
// created_by is the identifier of the user who created this invoice
CreatedBy string `json:"created_by,omitempty"`
// updated_by is the identifier of the user who last updated this invoice
UpdatedBy string `json:"updated_by,omitempty"`
// subscription contains the associated subscription information if requested
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
// customer contains the customer information associated with this invoice
Customer *CustomerResponse `json:"customer,omitempty"`
// total_tax is the total tax amount for this invoice
TotalTax decimal.Decimal `json:"total_tax" swaggertype:"string"`
// tax_applied_records contains the tax applied records associated with this invoice
Taxes []*TaxAppliedResponse `json:"taxes,omitempty"`
// coupon_applications contains the coupon applications associated with this invoice
CouponApplications []*CouponApplicationResponse `json:"coupon_applications,omitempty"`
}
InvoiceResponse represents the response payload containing invoice information
func NewInvoiceResponse ¶
func NewInvoiceResponse(inv *invoice.Invoice) *InvoiceResponse
NewInvoiceResponse creates a new invoice response from domain invoice
func (*InvoiceResponse) WithCouponApplications ¶ added in v1.0.21
func (r *InvoiceResponse) WithCouponApplications(couponApplications []*CouponApplicationResponse) *InvoiceResponse
WithCouponApplications adds coupon applications to the invoice response
func (*InvoiceResponse) WithCustomer ¶
func (r *InvoiceResponse) WithCustomer(customer *CustomerResponse) *InvoiceResponse
WithCustomer adds customer information to the invoice response
func (*InvoiceResponse) WithSubscription ¶
func (r *InvoiceResponse) WithSubscription(sub *SubscriptionResponse) *InvoiceResponse
func (*InvoiceResponse) WithTaxes ¶ added in v1.0.21
func (r *InvoiceResponse) WithTaxes(taxes []*TaxAppliedResponse) *InvoiceResponse
WithTaxAppliedRecords adds tax applied records to the invoice response
func (*InvoiceResponse) WithUsageAnalytics ¶ added in v1.0.21
func (r *InvoiceResponse) WithUsageAnalytics(usageAnalytics map[string][]SourceUsageItem) *InvoiceResponse
WithUsageAnalytics adds usage analytics to the invoice response
func (*InvoiceResponse) WithUsageBreakdown ¶ added in v1.0.23
func (r *InvoiceResponse) WithUsageBreakdown(usageBreakdown map[string][]UsageBreakdownItem) *InvoiceResponse
WithUsageBreakdown adds flexible usage breakdown to the invoice response
type InvoiceVoidRequest ¶ added in v1.0.27
type InvoiceVoidRequest struct {
// metadata will only add/override the values of key-value pairs provided in this request.
// for a complete override of metadata field, refer update invoice (PUT /invoices) endpoint
Metadata types.Metadata `json:"metadata,omitempty"`
}
func (*InvoiceVoidRequest) Validate ¶ added in v1.0.27
func (r *InvoiceVoidRequest) Validate() error
type LineItemCommitmentConfig ¶ added in v1.0.47
type LineItemCommitmentConfig struct {
// CommitmentAmount is the minimum amount committed for this line item
CommitmentAmount *decimal.Decimal `json:"commitment_amount,omitempty"`
// CommitmentQuantity is the minimum quantity committed for this line item
CommitmentQuantity *decimal.Decimal `json:"commitment_quantity,omitempty"`
// CommitmentType specifies whether commitment is based on amount or quantity
CommitmentType types.CommitmentType `json:"commitment_type,omitempty"`
// OverageFactor is a multiplier applied to usage beyond the commitment
OverageFactor *decimal.Decimal `json:"overage_factor,omitempty"`
// EnableTrueUp determines if true-up fee should be applied when usage is below commitment
EnableTrueUp *bool `json:"enable_true_up,omitempty"`
// IsWindowCommitment determines if commitment is applied per window (e.g., per day) rather than per billing period
IsWindowCommitment *bool `json:"is_window_commitment,omitempty"`
}
LineItemCommitmentConfig represents commitment configuration for a line item
func (*LineItemCommitmentConfig) Validate ¶ added in v1.0.47
func (c *LineItemCommitmentConfig) Validate() error
Validate validates the line item commitment configuration
type LineItemParams ¶ added in v1.0.23
type LineItemParams struct {
Subscription *SubscriptionResponse
Price *PriceResponse
Plan *PlanResponse // Optional, for plan-based line items
Addon *AddonResponse // Optional, for addon-based line items
EntityType types.SubscriptionLineItemEntityType
}
LineItemParams contains all necessary parameters for creating a line item
type LinkTaxRateToEntityRequest ¶ added in v1.0.21
type LinkTaxRateToEntityRequest struct {
TaxRateOverrides []*TaxRateOverride `json:"tax_rate_overrides" binding:"omitempty"`
ExistingTaxAssociations []*TaxAssociationResponse `json:"existing_tax_associations" binding:"omitempty"`
EntityType types.TaxRateEntityType `json:"entity_type" binding:"required" default:"tenant"`
EntityID string `json:"entity_id" binding:"required"`
}
func (*LinkTaxRateToEntityRequest) Validate ¶ added in v1.0.21
func (r *LinkTaxRateToEntityRequest) Validate() error
type LinkedIntegrationsResponse ¶
type LinkedIntegrationsResponse struct {
Providers []string `json:"providers"`
}
LinkedIntegrationsResponse represents the response for listing linked integrations
type ListAddonAssociationsResponse ¶ added in v1.0.47
type ListAddonAssociationsResponse = types.ListResponse[*AddonAssociationResponse]
ListAddonAssociationsResponse represents the response for listing addon associations
type ListAddonsResponse ¶ added in v1.0.21
type ListAddonsResponse = types.ListResponse[*AddonResponse]
ListAddonsResponse represents the response for listing addons
type ListAlertLogsResponse ¶ added in v1.0.35
type ListAlertLogsResponse struct {
Items []*AlertLogResponse `json:"items"`
Pagination *types.PaginationResponse `json:"pagination"`
}
ListAlertLogsResponse represents the response for listing alert logs
type ListConnectionsResponse ¶ added in v1.0.21
type ListConnectionsResponse struct {
Connections []ConnectionResponse `json:"connections"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ListConnectionsResponse represents the response for listing connections
type ListCostSheetsResponse ¶ added in v1.0.18
type ListCostSheetsResponse struct {
Items []*CostSheetResponse `json:"items"`
Pagination *types.PaginationResponse `json:"pagination"`
}
ListCostSheetsResponse represents the legacy response for listing costsheets (deprecated)
type ListCostsheetResponse ¶ added in v1.0.33
type ListCostsheetResponse struct {
Items []*CostsheetResponse `json:"items"`
Pagination *types.PaginationResponse `json:"pagination"`
}
ListCostsheetResponse represents the response for listing costsheet records
type ListCouponApplicationsResponse ¶ added in v1.0.21
type ListCouponApplicationsResponse = types.ListResponse[*CouponApplicationResponse]
ListCouponApplicationsResponse represents the response for listing coupon applications
type ListCouponAssociationsResponse ¶ added in v1.0.21
type ListCouponAssociationsResponse = types.ListResponse[*CouponAssociationResponse]
ListCouponAssociationsResponse represents the response for listing coupon associations
type ListCouponsResponse ¶ added in v1.0.21
type ListCouponsResponse = types.ListResponse[*CouponResponse]
ListCouponsResponse represents the response for listing coupons
type ListCreditGrantApplicationsResponse ¶ added in v1.0.38
type ListCreditGrantApplicationsResponse = types.ListResponse[*CreditGrantApplicationResponse]
ListCreditGrantApplicationsResponse represents a paginated list of credit grant applications
type ListCreditGrantsResponse ¶ added in v1.0.18
type ListCreditGrantsResponse = types.ListResponse[*CreditGrantResponse]
ListCreditGrantsResponse represents a paginated list of credit grants
type ListCreditNotesResponse ¶ added in v1.0.18
type ListCreditNotesResponse = types.ListResponse[*CreditNoteResponse]
ListCreditNotesResponse represents the paginated response for listing credit notes
type ListCustomersResponse ¶
type ListCustomersResponse = types.ListResponse[*CustomerResponse]
ListCustomersResponse represents the response for listing customers @Description Response object for listing customers with pagination
type ListEntitlementsResponse ¶
type ListEntitlementsResponse = types.ListResponse[*EntitlementResponse]
ListEntitlementsResponse represents a paginated list of entitlements
type ListEntityIntegrationMappingsResponse ¶ added in v1.0.21
type ListEntityIntegrationMappingsResponse = types.ListResponse[*EntityIntegrationMappingResponse]
ListEntityIntegrationMappingsResponse represents the response for listing entity integration mappings
type ListEnvironmentsResponse ¶
type ListEnvironmentsResponse struct {
Environments []EnvironmentResponse `json:"environments"`
Total int `json:"total"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type ListFeaturesResponse ¶
type ListFeaturesResponse = types.ListResponse[*FeatureResponse]
ListFeaturesResponse represents a paginated list of features
type ListGroupsResponse ¶ added in v1.0.34
type ListGroupsResponse = types.ListResponse[*GroupResponse]
ListGroupsResponse represents the response for listing groups
type ListInvoicesResponse ¶
type ListInvoicesResponse = types.ListResponse[*InvoiceResponse]
ListInvoicesResponse represents the paginated response for listing invoices
type ListMetersResponse ¶
type ListMetersResponse = types.ListResponse[*MeterResponse]
ListMetersResponse represents a paginated list of meters
type ListPaymentMethodsRequest ¶ added in v1.0.28
type ListPaymentMethodsRequest struct {
Provider string `json:"provider" binding:"required"` // Payment provider: "stripe", "razorpay", etc.
Limit int `json:"limit,omitempty"` // Number of results to return (default: 10, max: 100)
StartingAfter string `json:"starting_after,omitempty"` // Pagination cursor
EndingBefore string `json:"ending_before,omitempty"` // Pagination cursor
}
ListPaymentMethodsRequest represents a request to list payment methods for a customer (GET request)
func (*ListPaymentMethodsRequest) Validate ¶ added in v1.0.28
func (r *ListPaymentMethodsRequest) Validate() error
Validate validates the list payment methods request
type ListPaymentsResponse ¶
type ListPaymentsResponse struct {
Items []*PaymentResponse `json:"items"`
Pagination types.PaginationResponse `json:"pagination"`
}
ListPaymentsResponse represents a paginated list of payments
type ListPlansResponse ¶
type ListPlansResponse = types.ListResponse[*PlanResponse]
ListPlansResponse represents the response for listing plans with prices, entitlements, and credit grants
type ListPriceUnitsResponse ¶ added in v1.0.21
type ListPriceUnitsResponse = types.ListResponse[*PriceUnitResponse]
ListPriceUnitsResponse represents the response for listing price units
type ListPricesResponse ¶
type ListPricesResponse = types.ListResponse[*PriceResponse]
ListPricesResponse represents the response for listing prices
type ListScheduledTasksResponse ¶ added in v1.0.32
type ListScheduledTasksResponse = types.ListResponse[*ScheduledTaskResponse]
ListScheduledTasksResponse represents a list of scheduled tasks
func ToScheduledTaskListResponse ¶ added in v1.0.32
func ToScheduledTaskListResponse(tasks []*scheduledtask.ScheduledTask, pagination types.PaginationResponse) *ListScheduledTasksResponse
ToScheduledTaskListResponse converts domain scheduled tasks to a list response
type ListSecretsResponse ¶
type ListSecretsResponse = types.ListResponse[*SecretResponse]
ListSecretsResponse represents the response for listing secrets
type ListSetupIntentsRequest ¶ added in v1.0.28
type ListSetupIntentsRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
PaymentMethodID string `json:"payment_method_id,omitempty"` // Filter by specific payment method
Status string `json:"status,omitempty"` // Filter by status (succeeded, requires_payment_method, etc.)
Limit int `json:"limit,omitempty"` // Number of results to return (default: 10, max: 100)
StartingAfter string `json:"starting_after,omitempty"` // Pagination cursor
EndingBefore string `json:"ending_before,omitempty"` // Pagination cursor
}
ListSetupIntentsRequest represents a request to list Setup Intents for a customer
func (*ListSetupIntentsRequest) Validate ¶ added in v1.0.28
func (r *ListSetupIntentsRequest) Validate() error
Validate validates the list Setup Intents request
type ListSetupIntentsResponse ¶ added in v1.0.28
type ListSetupIntentsResponse struct {
Data []SetupIntentListItem `json:"data"`
HasMore bool `json:"has_more"`
TotalCount int `json:"total_count"`
}
ListSetupIntentsResponse represents the response from listing Setup Intents
type ListSubscriptionPausesResponse ¶
type ListSubscriptionPausesResponse struct {
// List of subscription pause objects
// @Description Array of subscription pauses
Items []*SubscriptionPauseResponse `json:"items"`
// Total number of pauses
// @Description Total count of subscription pauses in the response
Total int `json:"total"`
}
ListSubscriptionPausesResponse represents a list of subscription pauses in API responses @Description Response object for listing subscription pauses with total count
func NewListSubscriptionPausesResponse ¶
func NewListSubscriptionPausesResponse(pauses []*subscription.SubscriptionPause) *ListSubscriptionPausesResponse
NewListSubscriptionPausesResponse creates a new list subscription pauses response
type ListSubscriptionPhasesResponse ¶ added in v1.0.38
type ListSubscriptionPhasesResponse = types.ListResponse[*SubscriptionPhaseResponse]
ListSubscriptionPhasesResponse represents the response for listing subscription phases
type ListSubscriptionsResponse ¶
type ListSubscriptionsResponse = types.ListResponse[*SubscriptionResponse]
ListSubscriptionsResponse represents the response for listing subscriptions
type ListTasksResponse ¶
type ListTasksResponse struct {
Items []*TaskResponse `json:"items"`
Pagination types.PaginationResponse `json:"pagination"`
}
ListTasksResponse represents the response for listing tasks
type ListTaxAppliedResponse ¶ added in v1.0.21
type ListTaxAppliedResponse = types.ListResponse[*TaxAppliedResponse]
type ListTaxAssociationsResponse ¶ added in v1.0.21
type ListTaxAssociationsResponse = types.ListResponse[*TaxAssociationResponse]
ListTaxAssociationsResponse represents the response for listing tax associations
type ListTaxRatesResponse ¶ added in v1.0.21
type ListTaxRatesResponse = types.ListResponse[*TaxRateResponse]
ListTaxRatesResponse represents the response for listing tax rates
type ListUsersResponse ¶ added in v1.0.36
type ListUsersResponse = types.ListResponse[*UserResponse]
ListUsersResponse is the response type for listing users with pagination
type ListWalletTransactionsResponse ¶
type ListWalletTransactionsResponse = types.ListResponse[*WalletTransactionResponse]
ListWalletTransactionsResponse represents the response for listing wallet transactions
type LoginRequest ¶
type LoginRequest struct {
Email string `json:"email" binding:"required,email" validate:"email"`
Password string `json:"password" binding:"required" validate:"min=8"`
Token string `json:"token" binding:"omitempty" validate:"omitempty"`
}
func (*LoginRequest) Validate ¶
func (r *LoginRequest) Validate() error
type ManualBalanceDebitRequest ¶ added in v1.0.36
type ManualBalanceDebitRequest struct {
// credits is the number of credits to debit from the wallet
Credits decimal.Decimal `json:"credits" swaggertype:"string"`
// transaction_reason is the reason for the transaction
TransactionReason types.TransactionReason `json:"transaction_reason,omitempty" binding:"required"`
// idempotency_key is a unique key for the transaction
IdempotencyKey *string `json:"idempotency_key" binding:"required"`
// description to add any specific details about the transaction
Description string `json:"description,omitempty"`
// metadata is a map of key-value pairs to store any additional information about the transaction
Metadata types.Metadata `json:"metadata,omitempty"`
}
ManualBalanceDebitRequest represents a request to debit credits from a wallet
func (*ManualBalanceDebitRequest) Validate ¶ added in v1.0.36
func (r *ManualBalanceDebitRequest) Validate() error
type MeterResponse ¶
type MeterResponse struct {
ID string `json:"id" example:"550e8400-e29b-41d4-a716-446655440000"`
Name string `json:"name" example:"API Usage Meter"`
TenantID string `json:"tenant_id" example:"tenant123"`
EventName string `json:"event_name" example:"api_request"`
Aggregation meter.Aggregation `json:"aggregation"`
Filters []meter.Filter `json:"filters"`
ResetUsage types.ResetUsage `json:"reset_usage"`
CreatedAt time.Time `json:"created_at" example:"2024-03-20T15:04:05Z"`
UpdatedAt time.Time `json:"updated_at" example:"2024-03-20T15:04:05Z"`
Status string `json:"status" example:"published"`
}
MeterResponse represents the meter response structure
func ToMeterResponse ¶
func ToMeterResponse(m *meter.Meter) *MeterResponse
Convert domain Meter to MeterResponse
func (*MeterResponse) ToMeter ¶ added in v1.0.17
func (r *MeterResponse) ToMeter() *meter.Meter
type MultiProviderPaymentMethodsResponse ¶ added in v1.0.28
type MultiProviderPaymentMethodsResponse struct {
Stripe []SetupIntentListItem `json:"stripe,omitempty"`
}
MultiProviderPaymentMethodsResponse represents payment methods grouped by provider
type OnboardingEventsRequest ¶ added in v1.0.0
type OnboardingEventsRequest struct {
CustomerID string `json:"customer_id" validate:"omitempty" example:"cus_01HKG8QWERTY123"`
FeatureID string `json:"feature_id" validate:"omitempty" example:"feat_01HKG8QWERTY123"`
SubscriptionID string `json:"subscription_id" validate:"omitempty" example:"sub_01HKG8QWERTY123"`
Duration int `json:"duration" validate:"omitempty,min=1,max=600" default:"60" example:"60"`
}
OnboardingEventsRequest represents the request to generate events for onboarding
func (*OnboardingEventsRequest) Validate ¶ added in v1.0.0
func (r *OnboardingEventsRequest) Validate() error
Validate validates the OnboardingEventsRequest
type OnboardingEventsResponse ¶ added in v1.0.0
type OnboardingEventsResponse struct {
Message string `json:"message"`
StartedAt time.Time `json:"started_at"`
Duration int `json:"duration"`
Count int `json:"count"`
CustomerID string `json:"customer_id"`
FeatureID string `json:"feature_id,omitempty"`
SubscriptionID string `json:"subscription_id,omitempty"`
}
OnboardingEventsResponse represents the response for onboarding events generation
type OverrideEntitlementRequest ¶ added in v1.0.36
type OverrideEntitlementRequest struct {
// EntitlementID references the plan/addon entitlement to override
EntitlementID string `json:"entitlement_id" validate:"required"`
// UsageLimit is the new usage limit (only these 3 fields can be overridden)
// For metered features, nil means unlimited usage
UsageLimit *int64 `json:"usage_limit"`
// IsEnabled determines if the entitlement is enabled or disabled
IsEnabled *bool `json:"is_enabled,omitempty"`
// StaticValue is the static value for static features
StaticValue *string `json:"static_value,omitempty"`
}
OverrideEntitlementRequest allows overriding entitlement values for a subscription
func (*OverrideEntitlementRequest) Validate ¶ added in v1.0.36
func (r *OverrideEntitlementRequest) Validate() error
Validate validates the entitlement override request
type OverrideLineItemRequest ¶ added in v1.0.21
type OverrideLineItemRequest struct {
// PriceID references the plan price to override
PriceID string `json:"price_id" validate:"required"`
// Quantity for this line item (optional)
Quantity *decimal.Decimal `json:"quantity,omitempty" swaggertype:"string"`
BillingModel types.BillingModel `json:"billing_model,omitempty"`
// Amount is the new price amount that overrides the original price (optional)
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
// TierMode determines how to calculate the price for a given quantity
TierMode types.BillingTier `json:"tier_mode,omitempty"`
// Tiers determines the pricing tiers for this line item
Tiers []CreatePriceTier `json:"tiers,omitempty"`
// TransformQuantity determines how to transform the quantity for this line item
TransformQuantity *price.TransformQuantity `json:"transform_quantity,omitempty"`
// PriceUnitAmount is the amount of the price unit (for CUSTOM type, FLAT_FEE/PACKAGE billing models)
PriceUnitAmount *decimal.Decimal `json:"price_unit_amount,omitempty" swaggertype:"string"`
// PriceUnitTiers are the tiers for the price unit (for CUSTOM type, TIERED billing model)
PriceUnitTiers []CreatePriceTier `json:"price_unit_tiers,omitempty"`
}
OverrideLineItemRequest represents a price override for a specific subscription
func (*OverrideLineItemRequest) Validate ¶ added in v1.0.21
func (r *OverrideLineItemRequest) Validate( priceMap map[string]*PriceResponse, lineItemsByPriceID map[string]*subscription.SubscriptionLineItem, EntityId string, ) error
Validate validates the override line item request with additional context This method should be called after basic validation to check business rules
type PauseSubscriptionRequest ¶
type PauseSubscriptionRequest struct {
// Mode for pausing the subscription
// @Description Determines when the pause takes effect. "immediate" pauses right away, "scheduled" pauses at a specified time
// @Enum immediate,scheduled
PauseMode types.PauseMode `json:"pause_mode" validate:"required"`
// Start date for the subscription pause
// @Description ISO 8601 timestamp when the pause should begin. Required when pause_mode is "scheduled"
// @Example "2024-01-15T00:00:00Z"
PauseStart *time.Time `json:"pause_start,omitempty" validate:"omitempty"`
// End date for the subscription pause
// @Description ISO 8601 timestamp when the pause should end. Cannot be used together with pause_days. Must be after pause_start
// @Example "2024-02-15T00:00:00Z"
PauseEnd *time.Time `json:"pause_end,omitempty" validate:"omitempty,gtfield=PauseStart"`
// Duration of the pause in days
// @Description Number of days to pause the subscription. Cannot be used together with pause_end. Must be greater than 0
// @Example 30
PauseDays *int `json:"pause_days,omitempty" validate:"omitempty,gt=0"`
// Reason for pausing the subscription
// @Description Optional reason for the pause. Maximum 255 characters
// @Example "Customer requested temporary suspension"
Reason string `json:"reason,omitempty" validate:"omitempty,max=255"`
// Whether to perform a dry run
// @Description If true, validates the request and shows impact without actually pausing the subscription
// @Example false
DryRun bool `json:"dry_run,omitempty"`
// Additional metadata as key-value pairs
// @Description Optional metadata for storing additional information about the pause
// @Example {"requested_by": "customer", "channel": "support_ticket"}
Metadata map[string]string `json:"metadata,omitempty"`
}
PauseSubscriptionRequest represents a request to pause a subscription @Description Request object for pausing an active subscription with various pause modes and options
func (*PauseSubscriptionRequest) Validate ¶
func (r *PauseSubscriptionRequest) Validate() error
Validate validates the pause subscription request
type PauseSubscriptionResponse ¶
type PauseSubscriptionResponse struct {
// The subscription that was paused
// @Description Updated subscription object after the pause operation
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
// Details of the pause operation
// @Description Information about the subscription pause that was created
Pause *SubscriptionPauseResponse `json:"pause,omitempty"`
// Impact on billing and charges
// @Description Details about how this pause affects billing, prorations, and upcoming charges
BillingImpact *types.BillingImpactDetails `json:"billing_impact"`
// Whether this was a dry run
// @Description Indicates if this was a simulation (true) or actual pause (false)
DryRun bool `json:"dry_run"`
}
PauseSubscriptionResponse represents the response to a pause subscription request @Description Response object containing the subscription, pause details, and billing impact information
func NewSubscriptionPauseResponse ¶
func NewSubscriptionPauseResponse(sub *subscription.Subscription, pause *subscription.SubscriptionPause) *PauseSubscriptionResponse
NewSubscriptionPauseResponse creates a new subscription pause response
type PaymentAttemptResponse ¶
type PaymentAttemptResponse struct {
ID string `json:"id"`
PaymentID string `json:"payment_id"`
AttemptNumber int `json:"attempt_number"`
ErrorMessage *string `json:"error_message,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
TenantID string `json:"tenant_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
PaymentAttemptResponse represents a payment attempt response
func NewPaymentAttemptResponse ¶
func NewPaymentAttemptResponse(a *payment.PaymentAttempt) *PaymentAttemptResponse
NewPaymentAttemptResponse creates a new payment attempt response from a payment attempt
type PaymentIntentResponse ¶ added in v1.0.22
type PaymentIntentResponse struct {
ID string `json:"id"`
Status string `json:"status"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CustomerID string `json:"customer_id"`
PaymentMethod string `json:"payment_method"`
CreatedAt int64 `json:"created_at"`
}
PaymentIntentResponse represents a payment intent response
type PaymentLinkResponse ¶ added in v1.0.21
type PaymentLinkResponse struct {
ID string `json:"id"`
PaymentURL string `json:"payment_url"`
PaymentIntentID string `json:"payment_intent_id,omitempty"`
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
Currency string `json:"currency"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
PaymentID string `json:"payment_id,omitempty"`
Gateway string `json:"gateway"`
ExpiresAt *int64 `json:"expires_at,omitempty"`
}
PaymentLinkResponse represents a generic payment link creation response
type PaymentMethodResponse ¶ added in v1.0.22
type PaymentMethodResponse struct {
ID string `json:"id"`
Type string `json:"type"`
Customer string `json:"customer"`
Created int64 `json:"created"`
Card *CardDetails `json:"card,omitempty"`
Metadata map[string]interface{} `json:"metadata"`
}
PaymentMethodResponse represents a payment method response
type PaymentParameters ¶ added in v1.0.25
type PaymentParameters struct {
// CollectionMethod defines how the payment should be collected (charge_automatically or send_invoice)
CollectionMethod *types.CollectionMethod `json:"collection_method,omitempty"`
// PaymentBehavior defines the behavior when payment fails (default_active, error_if_incomplete, etc.)
PaymentBehavior *types.PaymentBehavior `json:"payment_behavior,omitempty"`
// PaymentMethodID is the optional ID of the payment method to use for automatic charges
PaymentMethodID *string `json:"payment_method_id,omitempty"`
}
PaymentParameters encapsulates payment-related parameters for invoice processing
func NewPaymentParameters ¶ added in v1.0.25
func NewPaymentParameters(collectionMethod types.CollectionMethod, paymentBehavior types.PaymentBehavior, paymentMethodID *string) *PaymentParameters
NewPaymentParameters creates a new PaymentParameters from subscription data
func NewPaymentParametersFromSubscription ¶ added in v1.0.25
func NewPaymentParametersFromSubscription(collectionMethod string, paymentBehavior string, paymentMethodID *string) *PaymentParameters
NewPaymentParametersFromSubscription creates PaymentParameters from subscription fields
func (*PaymentParameters) NormalizePaymentParameters ¶ added in v1.0.25
func (p *PaymentParameters) NormalizePaymentParameters() *PaymentParameters
NormalizePaymentParameters handles backward compatibility for old collection behaviors If collection_method is "default_incomplete", it converts to charge_automatically + default_incomplete
type PaymentResponse ¶
type PaymentResponse struct {
ID string `json:"id"`
IdempotencyKey string `json:"idempotency_key"`
DestinationType types.PaymentDestinationType `json:"destination_type"`
DestinationID string `json:"destination_id"`
PaymentMethodType types.PaymentMethodType `json:"payment_method_type"`
PaymentMethodID string `json:"payment_method_id"`
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
Currency string `json:"currency"`
PaymentStatus types.PaymentStatus `json:"payment_status"`
TrackAttempts bool `json:"track_attempts"`
PaymentGateway *string `json:"payment_gateway,omitempty"`
GatewayPaymentID *string `json:"gateway_payment_id,omitempty"`
GatewayTrackingID *string `json:"gateway_tracking_id,omitempty"`
GatewayMetadata types.Metadata `json:"gateway_metadata,omitempty"`
PaymentURL *string `json:"payment_url,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
SucceededAt *time.Time `json:"succeeded_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
RefundedAt *time.Time `json:"refunded_at,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
Attempts []*PaymentAttemptResponse `json:"attempts,omitempty"`
InvoiceNumber *string `json:"invoice_number,omitempty"`
TenantID string `json:"tenant_id"`
SaveCardAndMakeDefault bool `json:"save_card_and_make_default"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
PaymentResponse represents a payment response
func NewPaymentResponse ¶
func NewPaymentResponse(p *payment.Payment) *PaymentResponse
NewPaymentResponse creates a new payment response from a payment
type PaymentStatusRequest ¶ added in v1.0.21
type PaymentStatusRequest struct {
SessionID string `json:"session_id" binding:"required"`
PaymentID string `json:"payment_id,omitempty"`
}
PaymentStatusRequest represents a request to get payment status
type PaymentStatusResponse ¶ added in v1.0.21
type PaymentStatusResponse struct {
SessionID string `json:"session_id"`
PaymentIntentID string `json:"payment_intent_id"`
PaymentMethodID string `json:"payment_method_id,omitempty"`
Status string `json:"status"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CustomerID string `json:"customer_id"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at"`
Metadata map[string]string `json:"metadata"`
}
PaymentStatusResponse represents the payment status from Stripe
type PlanResponse ¶
type PlanResponse struct {
*plan.Plan
// TODO: Add inline addons
Prices []*PriceResponse `json:"prices,omitempty"`
Entitlements []*EntitlementResponse `json:"entitlements,omitempty"`
CreditGrants []*CreditGrantResponse `json:"credit_grants,omitempty"`
}
type PlanSummary ¶ added in v1.0.25
type PlanSummary struct {
// id of the plan
ID string `json:"id"`
// name of the plan
Name string `json:"name"`
// lookup_key of the plan
LookupKey string `json:"lookup_key,omitempty"`
// description of the plan
Description string `json:"description,omitempty"`
}
PlanSummary contains summary information about a plan
type PortalAnalyticsRequest ¶ added in v1.0.50
type PortalAnalyticsRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" example:"feat_123,feat_456"`
Sources []string `json:"sources,omitempty" example:"api,web"`
StartTime time.Time `json:"start_time,omitempty" example:"2024-01-01T00:00:00Z"`
EndTime time.Time `json:"end_time,omitempty" example:"2024-01-31T23:59:59Z"`
GroupBy []string `json:"group_by,omitempty" example:"source,feature_id"`
WindowSize types.WindowSize `json:"window_size,omitempty" example:"DAY"`
Expand []string `json:"expand,omitempty" example:"price,meter,feature"`
PropertyFilters map[string][]string `json:"property_filters,omitempty"`
}
PortalAnalyticsRequest represents a request for usage analytics from the customer portal The ExternalCustomerID is implicitly derived from the authentication context
func (*PortalAnalyticsRequest) ToInternalRequest ¶ added in v1.0.50
func (r *PortalAnalyticsRequest) ToInternalRequest(externalCustomerID string) *GetUsageAnalyticsRequest
ToInternalRequest converts the portal analytics request to an internal GetUsageAnalyticsRequest with the customer ID injected from the authentication context
type PortalCostAnalyticsRequest ¶ added in v1.0.50
type PortalCostAnalyticsRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" example:"feat_123,feat_456"`
StartTime time.Time `json:"start_time" binding:"required" example:"2024-01-01T00:00:00Z"`
EndTime time.Time `json:"end_time" binding:"required" example:"2024-01-31T23:59:59Z"`
}
PortalCostAnalyticsRequest represents a request for cost analytics from the customer portal The ExternalCustomerID is implicitly derived from the authentication context
func (*PortalCostAnalyticsRequest) ToInternalRequest ¶ added in v1.0.50
func (r *PortalCostAnalyticsRequest) ToInternalRequest(externalCustomerID string) *GetCostAnalyticsRequest
ToInternalRequest converts the portal cost analytics request to an internal GetCostAnalyticsRequest with the customer ID injected from the authentication context
type PortalPaginatedRequest ¶ added in v1.0.50
type PortalPaginatedRequest struct {
Page int `form:"page" json:"page" example:"1"`
Limit int `form:"limit" json:"limit" example:"20"`
}
PortalPaginatedRequest represents a paginated request from the customer portal
type PortalSessionResponse ¶ added in v1.0.50
type PortalSessionResponse struct {
URL string `json:"url"`
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
}
PortalSessionResponse is the response containing the portal URL
type PriceResponse ¶
type PriceResponse struct {
*price.Price
Meter *MeterResponse `json:"meter,omitempty"`
Plan *PlanResponse `json:"plan,omitempty"`
Addon *AddonResponse `json:"addon,omitempty"`
Group *GroupResponse `json:"group,omitempty"`
PricingUnit *PriceUnitResponse `json:"pricing_unit,omitempty"`
}
type PriceUnitConfig ¶ added in v1.0.21
type PriceUnitConfig struct {
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
PriceUnit string `json:"price_unit" validate:"required,len=3"`
PriceUnitTiers []CreatePriceTier `json:"price_unit_tiers,omitempty"`
}
func (*PriceUnitConfig) Validate ¶ added in v1.0.49
func (p *PriceUnitConfig) Validate() error
type PriceUnitResponse ¶ added in v1.0.21
type ProcessScheduledCreditGrantApplicationsResponse ¶ added in v1.0.18
type ProrationDetail ¶ added in v1.0.25
type ProrationDetail struct {
LineItemID string `json:"line_item_id"`
PriceID string `json:"price_id"`
PlanName string `json:"plan_name,omitempty"`
OriginalAmount decimal.Decimal `json:"original_amount" swaggertype:"string"`
CreditAmount decimal.Decimal `json:"credit_amount" swaggertype:"string"`
ChargeAmount decimal.Decimal `json:"charge_amount" swaggertype:"string"`
ProrationDays int `json:"proration_days"`
Description string `json:"description,omitempty"`
}
ProrationDetail provides line-item level proration information
type ProrationDetails ¶ added in v1.0.25
type ProrationDetails struct {
// credit_amount is the credit amount from the old subscription
CreditAmount decimal.Decimal `json:"credit_amount" swaggertype:"string"`
// credit_description describes what the credit is for
CreditDescription string `json:"credit_description"`
// charge_amount is the charge amount for the new subscription
ChargeAmount decimal.Decimal `json:"charge_amount" swaggertype:"string"`
// charge_description describes what the charge is for
ChargeDescription string `json:"charge_description"`
// net_amount is the net amount (charge - credit)
NetAmount decimal.Decimal `json:"net_amount" swaggertype:"string"`
// proration_date is the date used for proration calculations
ProrationDate time.Time `json:"proration_date"`
// current_period_start is the start of the current billing period
CurrentPeriodStart time.Time `json:"current_period_start"`
// current_period_end is the end of the current billing period
CurrentPeriodEnd time.Time `json:"current_period_end"`
// days_used is the number of days used in the current period
DaysUsed int `json:"days_used"`
// days_remaining is the number of days remaining in the current period
DaysRemaining int `json:"days_remaining"`
// currency is the currency for all amounts
Currency string `json:"currency"`
}
ProrationDetails contains detailed proration calculations
type ProrationLineItem ¶ added in v1.0.25
type ProrationLineItem struct {
// description is the human-readable description
Description string `json:"description"`
// amount is the monetary amount (positive for charge, negative for credit)
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
// start_date is the period start this item covers
StartDate time.Time `json:"start_date"`
// end_date is the period end this item covers
EndDate time.Time `json:"end_date"`
// quantity is the quantity
Quantity decimal.Decimal `json:"quantity" swaggertype:"string"`
// price_id is the associated price ID
PriceID string `json:"price_id"`
// is_credit indicates if this is a credit (true) or charge (false)
IsCredit bool `json:"is_credit"`
}
ProrationLineItem represents a single proration credit or charge
type ProrationLineItemResult ¶ added in v1.0.25
type ProrationLineItemResult struct {
// credit_items are the credit line items
CreditItems []ProrationLineItem `json:"credit_items"`
// charge_items are the charge line items
ChargeItems []ProrationLineItem `json:"charge_items"`
// net_amount is the net amount for this line item
NetAmount decimal.Decimal `json:"net_amount" swaggertype:"string"`
// proration_date is when the proration takes effect
ProrationDate time.Time `json:"proration_date"`
// line_item_id is the subscription line item ID
LineItemID string `json:"line_item_id"`
}
ProrationLineItemResult represents proration results for a single line item
type ProrationResult ¶ added in v1.0.25
type ProrationResult struct {
// total_proration_amount is the net amount (credits - charges)
TotalProrationAmount decimal.Decimal `json:"total_proration_amount" swaggertype:"string"`
// line_item_results contains per-line-item proration details
LineItemResults map[string]*ProrationLineItemResult `json:"line_item_results"`
// currency is the currency code
Currency string `json:"currency"`
}
ProrationResult represents the result of proration calculations
type ROIResponse ¶ added in v1.0.18
type ROIResponse struct {
// ROI is the return on investment percentage
ROI decimal.Decimal `json:"roi" swaggertype:"string"`
// TotalRevenue is the total revenue for the period
TotalRevenue decimal.Decimal `json:"total_revenue" swaggertype:"string"`
// TotalCost is the total cost for the period
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
// Profit is the difference between revenue and cost
Profit decimal.Decimal `json:"profit" swaggertype:"string"`
// Period shows the time range for this calculation
Period CostPeriod `json:"period"`
}
ROIResponse represents the calculated ROI metrics.
type RecentSubscriptionsResponse ¶ added in v1.0.60
type RecentSubscriptionsResponse struct {
TotalCount int `json:"total_count"`
Plans []types.SubscriptionPlanCount `json:"plans"`
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
}
RecentSubscriptionsResponse represents recent subscriptions data
type RemoveAddonRequest ¶ added in v1.0.21
type RemoveAddonRequest struct {
AddonAssociationID string `json:"addon_association_id" validate:"required"`
Reason string `json:"reason,omitempty"`
}
RemoveAddonRequest is used by body-based endpoint /subscriptions/addon (DELETE)
func (*RemoveAddonRequest) Validate ¶ added in v1.0.35
func (r *RemoveAddonRequest) Validate() error
type ResumeSubscriptionRequest ¶
type ResumeSubscriptionRequest struct {
// Mode for resuming the subscription
// @Description Determines how the subscription should be resumed
// @Enum immediate,scheduled
ResumeMode types.ResumeMode `json:"resume_mode" validate:"required"`
// Whether to perform a dry run
// @Description If true, validates the request and shows impact without actually resuming the subscription
// @Example false
DryRun bool `json:"dry_run,omitempty"`
// Additional metadata as key-value pairs
// @Description Optional metadata for storing additional information about the resume operation
// @Example {"resumed_by": "admin", "reason": "issue_resolved"}
Metadata map[string]string `json:"metadata,omitempty"`
}
ResumeSubscriptionRequest represents a request to resume a subscription @Description Request object for resuming a paused subscription
func (*ResumeSubscriptionRequest) Validate ¶
func (r *ResumeSubscriptionRequest) Validate() error
Validate validates the resume subscription request
type ResumeSubscriptionResponse ¶
type ResumeSubscriptionResponse struct {
// The subscription that was resumed
// @Description Updated subscription object after the resume operation (only included if not a dry run)
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
// Details of the pause that was ended
// @Description Information about the subscription pause that was terminated
Pause *SubscriptionPauseResponse `json:"pause,omitempty"`
// Impact on billing and charges
// @Description Details about how resuming affects billing, prorations, and upcoming charges
BillingImpact *types.BillingImpactDetails `json:"billing_impact"`
// Whether this was a dry run
// @Description Indicates if this was a simulation (true) or actual resume (false)
DryRun bool `json:"dry_run"`
}
ResumeSubscriptionResponse represents the response to a resume subscription request @Description Response object containing the subscription, pause details, and billing impact after resuming
type RevenueTrendRequest ¶ added in v1.0.60
type RevenueTrendRequest struct {
WindowCount *int `json:"window_count,omitempty"` //by default, it's 3
}
RevenueTrendRequest represents parameters for revenue trend section
func (*RevenueTrendRequest) Validate ¶ added in v1.0.60
func (r *RevenueTrendRequest) Validate() error
Validate validates the revenue trend request
type RevenueTrendResponse ¶ added in v1.0.60
type RevenueTrendResponse struct {
Currency map[string]CurrencyRevenueWindows `json:"currency_revenue_windows"`
WindowSize types.WindowSize `json:"window_size"`
WindowCount int `json:"window_count"`
}
RevenueTrendResponse represents revenue trend data
type ScheduledTaskResponse ¶ added in v1.0.32
type ScheduledTaskResponse struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
ConnectionID string `json:"connection_id"`
EntityType types.ScheduledTaskEntityType `json:"entity_type"`
Interval types.ScheduledTaskInterval `json:"interval" enums:"hourly,daily"` // Note: "custom" is excluded from API docs
Enabled bool `json:"enabled"`
JobConfig *types.S3JobConfig `json:"job_config"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ScheduledTaskResponse represents a scheduled task response
func ToScheduledTaskResponse ¶ added in v1.0.32
func ToScheduledTaskResponse(task *scheduledtask.ScheduledTask) *ScheduledTaskResponse
ToScheduledTaskResponse converts a domain scheduled task to a response
type SecretResponse ¶
type SecretResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type types.SecretType `json:"type"`
Provider types.SecretProvider `json:"provider"`
DisplayID string `json:"display_id"`
Roles []string `json:"roles,omitempty"` // RBAC roles
UserType types.UserType `json:"user_type,omitempty"` // "user" or "service_account"
ExpiresAt *time.Time `json:"expires_at,omitempty"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
Status types.Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SecretResponse represents a secret in responses
func ToSecretResponse ¶
func ToSecretResponse(s *secret.Secret) *SecretResponse
ToSecretResponse converts a domain Secret to a SecretResponse
func ToSecretResponseList ¶
func ToSecretResponseList(secrets []*secret.Secret) []*SecretResponse
ToSecretResponseList converts a list of domain Secrets to SecretResponses
type SetDefaultPaymentMethodRequest ¶ added in v1.0.22
type SetDefaultPaymentMethodRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
PaymentMethodID string `json:"payment_method_id" binding:"required"`
}
SetDefaultPaymentMethodRequest represents a request to set default payment method
type SettingResponse ¶ added in v1.0.22
SettingResponse represents a setting in API responses
func NewSettingResponse ¶ added in v1.0.47
func NewSettingResponse(s *settings.Setting) *SettingResponse
type SetupIntentListItem ¶ added in v1.0.28
type SetupIntentListItem struct {
ID string `json:"id"`
Status string `json:"status"`
Usage string `json:"usage"`
CustomerID string `json:"customer_id"`
PaymentMethodID string `json:"payment_method_id,omitempty"`
PaymentMethodDetails *PaymentMethodResponse `json:"payment_method_details,omitempty"`
IsDefault bool `json:"is_default"`
CreatedAt int64 `json:"created_at"`
CancellationReason string `json:"cancellation_reason,omitempty"`
LastSetupError string `json:"last_setup_error,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
SetupIntentListItem represents a single Setup Intent in the list response
type SetupIntentResponse ¶ added in v1.0.28
type SetupIntentResponse struct {
SetupIntentID string `json:"setup_intent_id"`
CheckoutSessionID string `json:"checkout_session_id"`
CheckoutURL string `json:"checkout_url"`
ClientSecret string `json:"client_secret"`
Status string `json:"status"`
Usage string `json:"usage"`
CustomerID string `json:"customer_id"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at"`
}
SetupIntentResponse represents a response from creating a Setup Intent session
type SignUpRequest ¶
type SignUpRequest struct {
Email string `json:"email" binding:"required,email" validate:"email"`
Password string `json:"password" binding:"omitempty,min=8" validate:"omitempty,min=8"`
TenantName string `json:"tenant_name" binding:"omitempty" validate:"omitempty"`
Token string `json:"token" binding:"omitempty" validate:"omitempty"`
}
func (*SignUpRequest) Validate ¶
func (r *SignUpRequest) Validate() error
type SourceUsageItem ¶ added in v1.0.21
type SourceUsageItem struct {
// source is the name of the event source
Source string `json:"source"`
// cost is the cost attributed to this source for the line item
Cost string `json:"cost"`
// usage is the total usage amount from this source (optional, for additional context)
Usage *string `json:"usage,omitempty"`
// percentage is the percentage of total line item cost from this source (optional)
Percentage *string `json:"percentage,omitempty"`
// event_count is the number of events from this source (optional)
EventCount *int `json:"event_count,omitempty"`
}
SourceUsageItem represents the usage breakdown for a specific source within a line item
type StripeInvoiceSyncRequest ¶ added in v1.0.28
type StripeInvoiceSyncRequest struct {
InvoiceID string `json:"invoice_id"`
CollectionMethod types.CollectionMethod `json:"collection_method"`
}
StripeInvoiceSyncRequest represents the request for syncing an invoice to Stripe
type StripeInvoiceSyncResponse ¶ added in v1.0.28
type StripeInvoiceSyncResponse struct {
StripeInvoiceID string `json:"stripe_invoice_id"`
Status string `json:"status"`
PaymentIntentID string `json:"payment_intent_id,omitempty"`
HostedInvoiceURL string `json:"hosted_invoice_url,omitempty"`
InvoicePDF string `json:"invoice_pdf,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
StripeInvoiceSyncResponse represents the response from Stripe invoice sync
type StripePaymentLinkResponse ¶ added in v1.0.21
type StripePaymentLinkResponse struct {
ID string `json:"id"`
PaymentURL string `json:"payment_url"`
PaymentIntentID string `json:"payment_intent_id"`
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
Currency string `json:"currency"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
PaymentID string `json:"payment_id,omitempty"`
}
StripePaymentLinkResponse represents a response from creating a Stripe payment link
type SubscriptionChangeExecuteResponse ¶ added in v1.0.25
type SubscriptionChangeExecuteResponse struct {
// is_scheduled indicates if the change was scheduled or executed immediately
IsScheduled bool `json:"is_scheduled"`
// schedule_id is the ID of the created schedule (only if is_scheduled=true)
ScheduleID *string `json:"schedule_id,omitempty"`
// scheduled_at is when the change will execute (only if is_scheduled=true)
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
// old_subscription contains the archived subscription details (only if is_scheduled=false)
OldSubscription SubscriptionSummary `json:"old_subscription"`
// new_subscription contains the new subscription details (only if is_scheduled=false)
NewSubscription SubscriptionSummary `json:"new_subscription"`
// change_type indicates whether this was an upgrade, downgrade, or lateral change
ChangeType types.SubscriptionChangeType `json:"change_type"`
// invoice contains the immediate invoice generated for the change (if any)
Invoice *InvoiceResponse `json:"invoice,omitempty"`
// proration_applied contains details of the proration that was applied
ProrationApplied *ProrationDetails `json:"proration_applied,omitempty"`
// credit_grants contains any credit grants created for proration credits
CreditGrants []*CreditGrantResponse `json:"credit_grants,omitempty"`
// effective_date is when the change took effect
EffectiveDate time.Time `json:"effective_date"`
// metadata from the request
Metadata map[string]string `json:"metadata,omitempty"`
}
SubscriptionChangeExecuteResponse represents the result of executing a subscription change @Description Response after successfully executing a subscription plan change
type SubscriptionChangePreviewResponse ¶ added in v1.0.25
type SubscriptionChangePreviewResponse struct {
// subscription_id is the ID of the subscription being changed
SubscriptionID string `json:"subscription_id"`
// current_plan contains information about the current plan
CurrentPlan PlanSummary `json:"current_plan"`
// target_plan contains information about the target plan
TargetPlan PlanSummary `json:"target_plan"`
// change_type indicates whether this is an upgrade, downgrade, or lateral change
ChangeType types.SubscriptionChangeType `json:"change_type"`
// proration_details contains the calculated proration amounts
ProrationDetails *ProrationDetails `json:"proration_details,omitempty"`
// next_invoice_preview shows how the next regular invoice would be affected
NextInvoicePreview *InvoicePreview `json:"next_invoice_preview,omitempty"`
// effective_date is when the change would take effect
EffectiveDate time.Time `json:"effective_date"`
// new_billing_cycle shows the new billing cycle details
NewBillingCycle BillingCycleInfo `json:"new_billing_cycle"`
// warnings contains any warnings about the change
Warnings []string `json:"warnings,omitempty"`
// metadata from the request
Metadata map[string]string `json:"metadata,omitempty"`
}
SubscriptionChangePreviewResponse represents the preview of subscription changes @Description Response showing the financial impact of a subscription plan change
type SubscriptionChangeRequest ¶ added in v1.0.25
type SubscriptionChangeRequest struct {
// target_plan_id is the ID of the new plan to change to (required)
TargetPlanID string `json:"target_plan_id" validate:"required" binding:"required"`
// proration_behavior controls how proration is handled for the change
// Options: create_prorations, none
ProrationBehavior types.ProrationBehavior `json:"proration_behavior" validate:"required" binding:"required"`
// metadata contains additional key-value pairs for storing extra information
Metadata map[string]string `json:"metadata,omitempty"`
// billing_cadence is the billing cadence for the new subscription
BillingCadence types.BillingCadence `json:"billing_cadence" validate:"required" binding:"required"`
// billing_period is the billing period for the new subscription
BillingPeriod types.BillingPeriod `json:"billing_period" validate:"required" binding:"required"`
// billing_period_count is the billing period count for the new subscription
BillingPeriodCount int `json:"billing_period_count" default:"1"`
// billing_cycle is the billing cycle for the new subscription
BillingCycle types.BillingCycle `json:"billing_cycle" validate:"required" binding:"required"`
// change_at determines when the change should take effect (optional)
// If not provided or null: change executes immediately
// If "immediate": change executes immediately (explicit)
// If "period_end": change is scheduled for the end of the current billing period
ChangeAt *types.ScheduleType `json:"change_at,omitempty"`
}
SubscriptionChangeRequest represents the request to change a subscription plan @Description Request object for changing a subscription plan (upgrade/downgrade)
func (*SubscriptionChangeRequest) ToSubscriptionChange ¶ added in v1.0.25
func (r *SubscriptionChangeRequest) ToSubscriptionChange(ctx context.Context, subscriptionID string) *subscription.SubscriptionChange
ToSubscriptionChange converts the request to a domain subscription change
func (*SubscriptionChangeRequest) Validate ¶ added in v1.0.25
func (r *SubscriptionChangeRequest) Validate() error
Validate validates the subscription change request
type SubscriptionCouponRequest ¶ added in v1.0.38
type SubscriptionCouponRequest struct {
CouponID string `json:"coupon_id" validate:"required"`
StartDate time.Time `json:"start_date" validate:"required"`
EndDate *time.Time `json:"end_date,omitempty"`
LineItemID *string `json:"line_item_id,omitempty"`
SubscriptionPhaseID *string `json:"subscription_phase_id,omitempty"`
}
SubscriptionCouponRequest represents a coupon to be applied to a subscription If LineItemID is provided, the coupon is applied to that specific line item If LineItemID is omitted, the coupon is applied at the subscription level
func (*SubscriptionCouponRequest) Validate ¶ added in v1.0.38
func (r *SubscriptionCouponRequest) Validate() error
Validate validates the SubscriptionCouponRequest
type SubscriptionEntitlementsResponse ¶ added in v1.0.35
type SubscriptionEntitlementsResponse struct {
SubscriptionID string `json:"subscription_id"`
PlanID string `json:"plan_id"`
Features []*AggregatedFeature `json:"features"`
}
SubscriptionEntitlementsResponse represents the response for subscription entitlements
type SubscriptionLineItemRequest ¶
type SubscriptionLineItemRequest struct {
PriceID string `json:"price_id" validate:"required"`
Quantity decimal.Decimal `json:"quantity" validate:"required" swaggertype:"string"`
DisplayName string `json:"display_name,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
// Commitment fields
CommitmentAmount *decimal.Decimal `json:"commitment_amount,omitempty"`
CommitmentQuantity *decimal.Decimal `json:"commitment_quantity,omitempty"`
CommitmentType types.CommitmentType `json:"commitment_type,omitempty"`
CommitmentOverageFactor *decimal.Decimal `json:"commitment_overage_factor,omitempty"`
CommitmentTrueUpEnabled bool `json:"commitment_true_up_enabled,omitempty"`
CommitmentWindowed bool `json:"commitment_windowed,omitempty"`
}
SubscriptionLineItemRequest represents the request to create a subscription line item
func (*SubscriptionLineItemRequest) ToSubscriptionLineItem ¶
func (r *SubscriptionLineItemRequest) ToSubscriptionLineItem(ctx context.Context) *subscription.SubscriptionLineItem
ToSubscriptionLineItem converts a request to a domain subscription line item
type SubscriptionLineItemResponse ¶
type SubscriptionLineItemResponse struct {
*subscription.SubscriptionLineItem
Price *PriceResponse `json:"price,omitempty"`
}
SubscriptionLineItemResponse represents the response for a subscription line item
type SubscriptionPauseResponse ¶
type SubscriptionPauseResponse struct {
*subscription.SubscriptionPause
}
SubscriptionPauseResponse represents a subscription pause in API responses @Description Response object containing subscription pause information
type SubscriptionPhaseCreateRequest ¶ added in v1.0.38
type SubscriptionPhaseCreateRequest struct {
StartDate time.Time `json:"start_date" validate:"required"`
EndDate *time.Time `json:"end_date,omitempty"`
// Coupons represents subscription-level coupons to be applied to this phase
Coupons []string `json:"coupons,omitempty"`
// LineItemCoupons represents line item-level coupons (map of line_item_id to coupon IDs)
LineItemCoupons map[string][]string `json:"line_item_coupons,omitempty"`
// OverrideLineItems allows customizing specific prices for this phase
// If not provided, phase will use the same line items as the subscription (plan prices)
OverrideLineItems []OverrideLineItemRequest `json:"override_line_items,omitempty" validate:"omitempty,dive"`
Metadata map[string]string `json:"metadata,omitempty"`
}
SubscriptionPhaseCreateRequest represents the request to create a subscription phase
func (*SubscriptionPhaseCreateRequest) ToSubscriptionPhase ¶ added in v1.0.38
func (r *SubscriptionPhaseCreateRequest) ToSubscriptionPhase(ctx context.Context, subscriptionID string) *subscription.SubscriptionPhase
func (*SubscriptionPhaseCreateRequest) Validate ¶ added in v1.0.38
func (r *SubscriptionPhaseCreateRequest) Validate() error
Validate validates the SubscriptionPhaseCreateRequest
type SubscriptionPhaseResponse ¶ added in v1.0.38
type SubscriptionPhaseResponse struct {
*subscription.SubscriptionPhase
}
SubscriptionPhaseResponse represents the response for subscription phase operations
type SubscriptionResponse ¶
type SubscriptionResponse struct {
*subscription.Subscription
Plan *PlanResponse `json:"plan"`
Customer *CustomerResponse `json:"customer"`
// CouponAssociations are the coupon associations for this subscription
CouponAssociations []*CouponAssociationResponse `json:"coupon_associations,omitempty"`
// Phases are the subscription phases for this subscription
Phases []*SubscriptionPhaseResponse `json:"phases,omitempty"`
// Credit grants are the credit grants for this subscription
CreditGrants []*CreditGrantResponse `json:"credit_grants,omitempty"`
// Latest invoice information for incomplete subscriptions
LatestInvoice *InvoiceResponse `json:"latest_invoice,omitempty"`
}
type SubscriptionResponseV2 ¶ added in v1.0.60
type SubscriptionResponseV2 struct {
*subscription.Subscription
// Plan is expanded only if "plan" is in expand parameter
Plan *PlanResponse `json:"plan,omitempty"`
// Customer is expanded only if "customer" is in expand parameter
Customer *CustomerResponse `json:"customer,omitempty"`
// LineItems is expanded only if "subscription_line_items" is in expand parameter
// Each line item can optionally include expanded price data
LineItems []*SubscriptionLineItemResponse `json:"line_items,omitempty"`
// CouponAssociations are included when "coupon_associations" is in expand parameter
CouponAssociations []*CouponAssociationResponse `json:"coupon_associations,omitempty"`
// Phases are included when "phases" is in expand parameter
Phases []*SubscriptionPhaseResponse `json:"phases,omitempty"`
// CreditGrants are included when "credit_grants" is in expand parameter
CreditGrants []*CreditGrantResponse `json:"credit_grants,omitempty"`
// Pauses are included when subscription has pause status
Pauses []*subscription.SubscriptionPause `json:"pauses,omitempty"`
}
SubscriptionResponseV2 represents the V2 response for a subscription with optional expanded fields based on the request expand parameter
type SubscriptionScheduleResponse ¶ added in v1.0.18
type SubscriptionScheduleResponse struct {
// id of the schedule
ID string `json:"id"`
// subscription_id is the ID of the subscription
SubscriptionID string `json:"subscription_id"`
// schedule_type is the type of schedule (plan_change, addon_change, etc.)
ScheduleType types.SubscriptionScheduleChangeType `json:"schedule_type"`
// scheduled_at is when the schedule will execute
ScheduledAt time.Time `json:"scheduled_at"`
// status is the current status of the schedule
Status types.ScheduleStatus `json:"status"`
// configuration contains type-specific configuration (e.g., target_plan_id for plan changes)
Configuration interface{} `json:"configuration,omitempty"`
// executed_at is when the schedule was executed
ExecutedAt *time.Time `json:"executed_at,omitempty"`
// cancelled_at is when the schedule was cancelled
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
// execution_result contains type-specific execution result
ExecutionResult interface{} `json:"execution_result,omitempty"`
// error_message contains the error if execution failed
ErrorMessage *string `json:"error_message,omitempty"`
// days_until_execution is the number of days until execution
DaysUntilExecution int `json:"days_until_execution"`
// can_be_cancelled indicates if the schedule can be cancelled
CanBeCancelled bool `json:"can_be_cancelled"`
// metadata from the schedule
Metadata map[string]string `json:"metadata,omitempty"`
// created_at timestamp
CreatedAt time.Time `json:"created_at"`
// updated_at timestamp
UpdatedAt time.Time `json:"updated_at"`
}
SubscriptionScheduleResponse represents a subscription schedule @Description Full details of a subscription schedule
func SubscriptionScheduleListResponseFromDomain ¶ added in v1.0.60
func SubscriptionScheduleListResponseFromDomain(schedules []*subscription.SubscriptionSchedule) []*SubscriptionScheduleResponse
SubscriptionScheduleListResponseFromDomain converts a list of domain schedules to DTOs
func SubscriptionScheduleResponseFromDomain ¶ added in v1.0.18
func SubscriptionScheduleResponseFromDomain(s *subscription.SubscriptionSchedule) *SubscriptionScheduleResponse
SubscriptionScheduleResponseFromDomain converts a domain schedule to a DTO
type SubscriptionSummary ¶ added in v1.0.25
type SubscriptionSummary struct {
// id of the subscription
ID string `json:"id"`
// status of the subscription
Status types.SubscriptionStatus `json:"status"`
// plan_id of the subscription
PlanID string `json:"plan_id"`
// current_period_start of the subscription
CurrentPeriodStart time.Time `json:"current_period_start"`
// current_period_end of the subscription
CurrentPeriodEnd time.Time `json:"current_period_end"`
// billing_anchor of the subscription
BillingAnchor time.Time `json:"billing_anchor"`
// created_at timestamp
CreatedAt time.Time `json:"created_at"`
// archived_at timestamp (for old subscriptions)
ArchivedAt *time.Time `json:"archived_at,omitempty"`
}
SubscriptionSummary contains summary information about a subscription
type SubscriptionSyncParams ¶ added in v1.0.30
type SubscriptionSyncParams struct {
Context context.Context
Subscription *subscription.Subscription
PlanPriceMap map[string]*price.Price
LineItems []*subscription.SubscriptionLineItem
SubscriptionPriceMap map[string]*PriceResponse
}
SubscriptionSyncParams contains all parameters needed for syncing a subscription with plan prices
type SubscriptionSyncResult ¶ added in v1.0.30
type SubscriptionSyncResult struct {
PricesProcessed int
LineItemsCreated int
LineItemsTerminated int
LineItemsSkippedAlreadyTerminated int
LineItemsSkippedOverridden int
LineItemsSkippedIncompatible int
LineItemsFailed int
}
SubscriptionSyncResult contains the results of syncing a subscription with plan prices
type SubscriptionUpdatePeriodResponse ¶
type SubscriptionUpdatePeriodResponse struct {
TotalSuccess int `json:"total_success"`
TotalFailed int `json:"total_failed"`
Items []*SubscriptionUpdatePeriodResponseItem `json:"items"`
StartAt time.Time `json:"start_at"`
}
type SubscriptionUsageByMetersResponse ¶
type SubscriptionUsageByMetersResponse struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
DisplayAmount string `json:"display_amount"`
Quantity float64 `json:"quantity"`
FilterValues price.JSONBFilters `json:"filter_values"`
MeterID string `json:"meter_id"`
MeterDisplayName string `json:"meter_display_name"`
Price *price.Price `json:"price"`
IsOverage bool `json:"is_overage"` // Whether this charge is at overage rate
OverageFactor float64 `json:"overage_factor,omitempty"` // Factor applied to this charge if in overage
}
type SuccessResponse ¶
type SuccessResponse struct {
Message string `json:"message"`
}
SuccessResponse represents a generic success response
type SyncPlanPricesResponse ¶ added in v1.0.23
type SyncPlanPricesResponse struct {
Message string `json:"message"`
PlanID string `json:"plan_id"`
PlanName string `json:"plan_name"`
SynchronizationSummary SynchronizationSummary `json:"synchronization_summary"`
}
type SynchronizationSummary ¶ added in v1.0.30
type SynchronizationSummary struct {
// Basic counts
SubscriptionsProcessed int `json:"subscriptions_processed"`
PricesProcessed int `json:"prices_processed"`
LineItemsCreated int `json:"line_items_created"`
LineItemsTerminated int `json:"line_items_terminated"`
LineItemsSkipped int `json:"line_items_skipped"`
LineItemsFailed int `json:"line_items_failed"`
// Detailed breakdown by category
SkippedAlreadyTerminated int `json:"skipped_already_terminated"`
SkippedOverridden int `json:"skipped_overridden"`
SkippedIncompatible int `json:"skipped_incompatible"`
// Price analysis
TotalPrices int `json:"total_prices"`
ActivePrices int `json:"active_prices"`
ExpiredPrices int `json:"expired_prices"`
}
type TaskResponse ¶
TaskResponse represents a task in responses
func NewTaskResponse ¶
func NewTaskResponse(t *task.Task) *TaskResponse
NewTaskResponse creates a new task response from a domain task
type TaxAppliedResponse ¶ added in v1.0.21
type TaxAppliedResponse struct {
taxapplied.TaxApplied `json:",inline"`
TaxRate *TaxRateResponse `json:"tax_rate,omitempty"`
}
TaxAppliedResponse represents the response for tax applied operations
type TaxAssociationResponse ¶ added in v1.0.21
type TaxAssociationResponse struct {
ID string `json:"id"`
TaxRateID string `json:"tax_rate_id"`
EntityType types.TaxRateEntityType `json:"entity_type"`
EntityID string `json:"entity_id"`
Priority int `json:"priority"`
AutoApply bool `json:"auto_apply"`
ValidFrom *time.Time `json:"valid_from,omitempty"`
ValidTo *time.Time `json:"valid_to,omitempty"`
Currency string `json:"currency"`
Metadata map[string]string `json:"metadata,omitempty"`
EnvironmentID string `json:"environment_id"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
TaxRate *TaxRateResponse `json:"tax_rate,omitempty"`
}
TaxAssociationResponse represents the response for tax association operations
func ToTaxAssociationResponse ¶ added in v1.0.21
func ToTaxAssociationResponse(tc *taxassociation.TaxAssociation) *TaxAssociationResponse
ToTaxAssociationResponse converts a domain TaxConfig to a TaxAssociationResponse
func (*TaxAssociationResponse) WithTaxRate ¶ added in v1.0.21
func (r *TaxAssociationResponse) WithTaxRate(taxRate *TaxRateResponse) *TaxAssociationResponse
type TaxAssociationUpdateRequest ¶ added in v1.0.21
type TaxAssociationUpdateRequest struct {
Priority *int `json:"priority" binding:"omitempty"`
AutoApply *bool `json:"auto_apply" binding:"omitempty"`
Metadata *map[string]string `json:"metadata" binding:"omitempty"`
}
func (*TaxAssociationUpdateRequest) Validate ¶ added in v1.0.21
func (r *TaxAssociationUpdateRequest) Validate() error
type TaxRateOverride ¶ added in v1.0.21
type TaxRateOverride struct {
TaxRateCode string `json:"tax_rate_code" binding:"required"`
Priority int `json:"priority" binding:"omitempty"`
Currency string `json:"currency" binding:"required"`
AutoApply bool `json:"auto_apply" binding:"omitempty" default:"true"`
Metadata map[string]string `json:"metadata" binding:"omitempty"`
}
TaxRateOverride represents a tax rate override for a specific entity This is used to override the tax rate for a specific entity i.e if you give `tax_overrides` in the create customer request it will link the tax rate to the customer else it will inherit the tenant tax rate, It links an existing tax rate to the entity The priority and auto apply fields are used to determine the order of the tax rates
func (*TaxRateOverride) ToTaxAssociationRequest ¶ added in v1.0.21
func (tr *TaxRateOverride) ToTaxAssociationRequest(_ context.Context, entityID string, entityType types.TaxRateEntityType) *CreateTaxAssociationRequest
func (*TaxRateOverride) Validate ¶ added in v1.0.21
func (tr *TaxRateOverride) Validate() error
type TaxRateResponse ¶ added in v1.0.21
TaxRateResponse represents the response for tax rate operations
type TenantBillingDetails ¶ added in v1.0.0
type TenantBillingDetails struct {
Email string `json:"email,omitempty"`
HelpEmail string `json:"help_email,omitempty"`
Phone string `json:"phone,omitempty"`
Address Address `json:"address,omitempty"`
}
func NewTenantBillingDetails ¶ added in v1.0.0
func NewTenantBillingDetails(b tenant.TenantBillingDetails) TenantBillingDetails
func (*TenantBillingDetails) ToDomain ¶ added in v1.0.0
func (r *TenantBillingDetails) ToDomain() tenant.TenantBillingDetails
type TenantBillingUsage ¶ added in v1.0.0
type TenantBillingUsage struct {
Usage *CustomerUsageSummaryResponse `json:"usage"`
Subscriptions []*SubscriptionResponse `json:"subscriptions"`
}
type TenantResponse ¶
type TenantResponse struct {
ID string `json:"id"`
Name string `json:"name"`
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Metadata *types.Metadata `json:"metadata,omitempty"`
}
func NewTenantResponse ¶
func NewTenantResponse(t *tenant.Tenant) *TenantResponse
type TopUpWalletRequest ¶
type TopUpWalletRequest struct {
// credits_to_add is the number of credits to add to the wallet
CreditsToAdd decimal.Decimal `json:"credits_to_add" swaggertype:"string"`
// amount is the amount in the currency of the wallet to be added
// NOTE: this is not the number of credits to add, but the amount in the currency
// amount = credits_to_add * conversion_rate
// if both amount and credits_to_add are provided, amount will be ignored
// ex if the wallet has a conversion_rate of 2 then adding an amount of
// 10 USD in the wallet wil add 5 credits in the wallet
Amount decimal.Decimal `json:"amount" swaggertype:"string"`
TransactionReason types.TransactionReason `json:"transaction_reason,omitempty" binding:"required"`
// expiry_date YYYYMMDD format in UTC timezone (optional to set nil means no expiry)
// for ex 20250101 means the credits will expire on 2025-01-01 00:00:00 UTC
// hence they will be available for use until 2024-12-31 23:59:59 UTC
ExpiryDate *int `json:"-"`
// expiry_date_utc is the expiry date in UTC timezone
// ex 2025-01-01 00:00:00 UTC
ExpiryDateUTC *time.Time `json:"expiry_date_utc,omitempty"`
// priority is the priority of the transaction
// lower number means higher priority
// default is nil which means no priority at all
Priority *int `json:"priority,omitempty"`
// idempotency_key is a unique key for the transaction
IdempotencyKey *string `json:"idempotency_key,omitempty"`
// description to add any specific details about the transaction
Description string `json:"description,omitempty"`
// metadata is a map of key-value pairs to store any additional information about the transaction
Metadata types.Metadata `json:"metadata,omitempty"`
}
TopUpWalletRequest represents a request to add credits to a wallet
func (*TopUpWalletRequest) Validate ¶
func (r *TopUpWalletRequest) Validate() error
type TopUpWalletResponse ¶ added in v1.0.38
type TopUpWalletResponse struct {
// Wallet transaction created (could be PENDING or COMPLETED)
WalletTransaction *WalletTransactionResponse `json:"wallet_transaction"`
// Invoice ID if an invoice was created (only for PURCHASED_CREDIT_INVOICED)
InvoiceID *string `json:"invoice_id,omitempty"`
// Wallet details after the operation
Wallet *WalletResponse `json:"wallet"`
}
TopUpWalletResponse represents the response for topping up a wallet
type TriggerForceRunRequest ¶ added in v1.0.32
type TriggerForceRunRequest struct {
StartTime *time.Time `json:"start_time,omitempty" validate:"omitempty"`
EndTime *time.Time `json:"end_time,omitempty" validate:"omitempty"`
}
TriggerForceRunRequest represents the request to trigger a force run
func (*TriggerForceRunRequest) Validate ¶ added in v1.0.32
func (r *TriggerForceRunRequest) Validate() error
Validate validates the force run request
type TriggerForceRunResponse ¶ added in v1.0.32
type TriggerForceRunResponse struct {
WorkflowID string `json:"workflow_id"`
Message string `json:"message"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Mode string `json:"mode"` // "custom" or "automatic"
}
TriggerForceRunResponse represents the response from force run trigger
type UpdateAddonRequest ¶ added in v1.0.21
type UpdateAddonRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
UpdateAddonRequest represents the request to update an addon
func (*UpdateAddonRequest) Validate ¶ added in v1.0.21
func (r *UpdateAddonRequest) Validate() error
type UpdateConnectionRequest ¶ added in v1.0.21
type UpdateConnectionRequest struct {
Name string `json:"name,omitempty" validate:"omitempty,max=255"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
SyncConfig *types.SyncConfig `json:"sync_config,omitempty" validate:"omitempty,dive"`
EncryptedSecretData *types.ConnectionMetadata `json:"encrypted_secret_data,omitempty"` // For updating webhook tokens, etc.
}
UpdateConnectionRequest represents the request to update a connection
func (*UpdateConnectionRequest) UnmarshalJSON ¶ added in v1.0.21
func (req *UpdateConnectionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshaling to handle flat metadata structure
type UpdateCostSheetRequest ¶ added in v1.0.18
type UpdateCostSheetRequest struct {
MeterID string `json:"meter_id,omitempty"`
PriceID string `json:"price_id,omitempty"`
}
UpdateCostSheetRequest represents the legacy request to update a costsheet (deprecated)
type UpdateCostsheetRequest ¶ added in v1.0.33
type UpdateCostsheetRequest struct {
Name string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
LookupKey string `json:"lookup_key,omitempty" validate:"omitempty,min=1,max=255"`
Description string `json:"description,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
UpdateCostsheetRequest represents the request to update an existing costsheet
func (*UpdateCostsheetRequest) UpdateCostsheet ¶ added in v1.0.33
func (r *UpdateCostsheetRequest) UpdateCostsheet(costsheet *costsheet.Costsheet, ctx context.Context)
UpdateCostsheet updates the costsheet with the provided data
func (*UpdateCostsheetRequest) Validate ¶ added in v1.0.33
func (r *UpdateCostsheetRequest) Validate() error
Validate validates the update costsheet request
type UpdateCostsheetResponse ¶ added in v1.0.33
type UpdateCostsheetResponse struct {
Costsheet *CostsheetResponse `json:"costsheet"`
}
UpdateCostsheetResponse represents the response for updating a costsheet
type UpdateCouponRequest ¶ added in v1.0.21
type UpdateCouponRequest struct {
Name *string `json:"name,omitempty"`
Metadata *map[string]string `json:"metadata,omitempty"`
}
UpdateCouponRequest represents the request to update an existing coupon
func (*UpdateCouponRequest) Validate ¶ added in v1.0.21
func (r *UpdateCouponRequest) Validate() error
Validate validates the UpdateCouponRequest
type UpdateCreditGrantRequest ¶ added in v1.0.18
type UpdateCreditGrantRequest struct {
Name *string `json:"name,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
}
UpdateCreditGrantRequest represents the request to update an existing credit grant
func (*UpdateCreditGrantRequest) UpdateCreditGrant ¶ added in v1.0.18
func (r *UpdateCreditGrantRequest) UpdateCreditGrant(grant *creditgrant.CreditGrant, ctx context.Context)
UpdateCreditGrant applies UpdateCreditGrantRequest to domain CreditGrant
type UpdateCustomerRequest ¶
type UpdateCustomerRequest struct {
// external_id is the updated external identifier for the customer
ExternalID *string `json:"external_id"`
// name is the updated name or company name for the customer
Name *string `json:"name"`
// email is the updated email address and must be a valid email format if provided
Email *string `json:"email" validate:"omitempty,email"`
// address_line1 is the updated primary address line with maximum 255 characters
AddressLine1 *string `json:"address_line1" validate:"omitempty,max=255"`
// address_line2 is the updated secondary address line with maximum 255 characters
AddressLine2 *string `json:"address_line2" validate:"omitempty,max=255"`
// address_city is the updated city name with maximum 100 characters
AddressCity *string `json:"address_city" validate:"omitempty,max=100"`
// address_state is the updated state, province, or region name with maximum 100 characters
AddressState *string `json:"address_state" validate:"omitempty,max=100"`
// address_postal_code is the updated postal code with maximum 20 characters
AddressPostalCode *string `json:"address_postal_code" validate:"omitempty,max=20"`
// address_country is the updated two-letter ISO 3166-1 alpha-2 country code
AddressCountry *string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
// metadata contains updated key-value pairs that will replace existing metadata
Metadata map[string]string `json:"metadata,omitempty"`
// integration_entity_mapping contains provider integration mappings for this customer
IntegrationEntityMapping []*IntegrationEntityMapping `json:"integration_entity_mapping,omitempty"`
// parent_customer_id is the internal FlexPrice ID of the parent customer
ParentCustomerID *string `json:"parent_customer_id,omitempty"`
// parent_customer_external_id is the external ID of the parent customer from your system
// Exactly one of parent_customer_id or parent_customer_external_id may be provided
// If you provide the external ID, the parent customer value will be ignored
ParentCustomerExternalID *string `json:"parent_customer_external_id,omitempty"`
}
UpdateCustomerRequest represents the request to update an existing customer @Description Request object for updating an existing customer. All fields are optional - only provided fields will be updated
func (*UpdateCustomerRequest) Validate ¶
func (r *UpdateCustomerRequest) Validate() error
type UpdateEntitlementRequest ¶
type UpdateEntitlementRequest struct {
IsEnabled *bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit"`
UsageResetPeriod types.EntitlementUsageResetPeriod `json:"usage_reset_period"`
IsSoftLimit *bool `json:"is_soft_limit"`
StaticValue string `json:"static_value"`
}
UpdateEntitlementRequest represents the request to update an existing entitlement
type UpdateEntityIntegrationMappingRequest ¶ added in v1.0.22
type UpdateEntityIntegrationMappingRequest struct {
ProviderEntityID *string `json:"provider_entity_id,omitempty" validate:"omitempty,max=255"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
func (*UpdateEntityIntegrationMappingRequest) Validate ¶ added in v1.0.22
func (r *UpdateEntityIntegrationMappingRequest) Validate() error
type UpdateEnvironmentRequest ¶
func (*UpdateEnvironmentRequest) Validate ¶
func (r *UpdateEnvironmentRequest) Validate() error
type UpdateFeatureRequest ¶
type UpdateFeatureRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
UnitSingular *string `json:"unit_singular,omitempty"`
UnitPlural *string `json:"unit_plural,omitempty"`
Filters *[]meter.Filter `json:"filters,omitempty"`
AlertSettings *types.AlertSettings `json:"alert_settings,omitempty"`
}
type UpdateInvoicePaymentRequest ¶
type UpdateInvoicePaymentRequest struct {
// payment_status is the new payment status to set for the invoice (paid, unpaid, etc.)
PaymentStatus types.PaymentStatus `json:"payment_status" validate:"required"`
}
UpdateInvoicePaymentRequest represents the request payload for updating invoice payment status
func (*UpdateInvoicePaymentRequest) Validate ¶
func (r *UpdateInvoicePaymentRequest) Validate() error
type UpdateInvoiceRequest ¶ added in v1.0.21
type UpdateInvoiceRequest struct {
// invoice_pdf_url is the URL where customers can download the PDF version of this invoice
InvoicePDFURL *string `json:"invoice_pdf_url,omitempty"`
DueDate *time.Time `json:"due_date,omitempty"`
// Invoice metadata will be overridden with the request metadata
Metadata *types.Metadata `json:"metadata,omitempty"`
}
UpdateInvoiceRequest represents the request payload for updating an invoice
func (*UpdateInvoiceRequest) Validate ¶ added in v1.0.21
func (r *UpdateInvoiceRequest) Validate() error
type UpdateMeterRequest ¶
UpdateMeterRequest represents the request payload for updating a meter
type UpdatePaymentRequest ¶
type UpdatePaymentRequest struct {
PaymentStatus *string `json:"payment_status,omitempty"`
PaymentGateway *string `json:"payment_gateway,omitempty"`
GatewayPaymentID *string `json:"gateway_payment_id,omitempty"`
PaymentMethodID *string `json:"payment_method_id,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
SucceededAt *time.Time `json:"succeeded_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
}
UpdatePaymentRequest represents a request to update a payment
type UpdatePaymentStatusRequest ¶
type UpdatePaymentStatusRequest struct {
// payment_status is the new payment status to set for the invoice (paid, unpaid, etc.)
PaymentStatus types.PaymentStatus `json:"payment_status" binding:"required"`
// amount is the optional payment amount to record
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
}
UpdatePaymentStatusRequest represents the request payload for updating an invoice's payment status
func (*UpdatePaymentStatusRequest) Validate ¶
func (r *UpdatePaymentStatusRequest) Validate() error
type UpdatePlanRequest ¶
type UpdatePriceRequest ¶
type UpdatePriceRequest struct {
// All price fields that can be updated
// Non-critical fields (can be updated directly)
LookupKey string `json:"lookup_key,omitempty"`
Description string `json:"description,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
EffectiveFrom *time.Time `json:"effective_from,omitempty"`
BillingModel types.BillingModel `json:"billing_model,omitempty"`
// Amount is the new price amount that overrides the original price (optional)
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
// TierMode determines how to calculate the price for a given quantity
TierMode types.BillingTier `json:"tier_mode,omitempty"`
// Tiers determines the pricing tiers for this line item
Tiers []CreatePriceTier `json:"tiers,omitempty"`
// TransformQuantity determines how to transform the quantity for this line item
TransformQuantity *price.TransformQuantity `json:"transform_quantity,omitempty"`
// PriceUnitAmount is the price unit amount (for CUSTOM price unit type, FLAT_FEE/PACKAGE billing models)
PriceUnitAmount *decimal.Decimal `json:"price_unit_amount,omitempty" swaggertype:"string"`
// PriceUnitTiers are the price unit tiers (for CUSTOM price unit type, TIERED billing model)
PriceUnitTiers []CreatePriceTier `json:"price_unit_tiers,omitempty"`
// GroupID is the id of the group to update the price in
GroupID string `json:"group_id,omitempty"`
}
func (*UpdatePriceRequest) ShouldCreateNewPrice ¶ added in v1.0.30
func (r *UpdatePriceRequest) ShouldCreateNewPrice() bool
ShouldCreateNewPrice checks if the request contains any critical fields that require creating a new price
func (*UpdatePriceRequest) ToCreatePriceRequest ¶ added in v1.0.30
func (r *UpdatePriceRequest) ToCreatePriceRequest(existingPrice *price.Price) CreatePriceRequest
ToCreatePriceRequest converts the update request to a create request for the new price
func (*UpdatePriceRequest) Validate ¶ added in v1.0.30
func (r *UpdatePriceRequest) Validate() error
type UpdatePriceUnitRequest ¶ added in v1.0.21
type UpdatePriceUnitRequest struct {
Name *string `json:"name,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
func (*UpdatePriceUnitRequest) Validate ¶ added in v1.0.49
func (r *UpdatePriceUnitRequest) Validate() error
type UpdateScheduledTaskRequest ¶ added in v1.0.32
type UpdateScheduledTaskRequest struct {
Enabled *bool `json:"enabled" validate:"required"`
}
UpdateScheduledTaskRequest represents a request to update a scheduled task Only enabled field is allowed to be updated
func (*UpdateScheduledTaskRequest) Validate ¶ added in v1.0.32
func (r *UpdateScheduledTaskRequest) Validate() error
Validate validates the update request
type UpdateSettingRequest ¶ added in v1.0.22
type UpdateSettingRequest struct {
Value map[string]interface{} `json:"value,omitempty"`
}
func (*UpdateSettingRequest) Validate ¶ added in v1.0.22
func (r *UpdateSettingRequest) Validate(key types.SettingKey) error
UpdateSettingRequest represents the request to update an existing setting
type UpdateSubscriptionLineItemRequest ¶ added in v1.0.30
type UpdateSubscriptionLineItemRequest struct {
// EffectiveFrom for the existing line item (if not provided, defaults to now)
EffectiveFrom *time.Time `json:"effective_from,omitempty"`
BillingModel types.BillingModel `json:"billing_model,omitempty"`
// Amount is the new price amount that overrides the original price
Amount *decimal.Decimal `json:"amount,omitempty" swaggertype:"string"`
// TierMode determines how to calculate the price for a given quantity
TierMode types.BillingTier `json:"tier_mode,omitempty"`
// Tiers determines the pricing tiers for this line item
Tiers []CreatePriceTier `json:"tiers,omitempty"`
// TransformQuantity determines how to transform the quantity for this line item
TransformQuantity *price.TransformQuantity `json:"transform_quantity,omitempty"`
// Metadata for the new line item
Metadata map[string]string `json:"metadata,omitempty"`
// Commitment fields
CommitmentAmount *decimal.Decimal `json:"commitment_amount,omitempty"`
CommitmentQuantity *decimal.Decimal `json:"commitment_quantity,omitempty"`
CommitmentType types.CommitmentType `json:"commitment_type,omitempty"`
CommitmentOverageFactor *decimal.Decimal `json:"commitment_overage_factor,omitempty"`
CommitmentTrueUpEnabled *bool `json:"commitment_true_up_enabled,omitempty"`
CommitmentWindowed *bool `json:"commitment_windowed,omitempty"`
}
func (*UpdateSubscriptionLineItemRequest) HasCommitment ¶ added in v1.0.47
func (r *UpdateSubscriptionLineItemRequest) HasCommitment() bool
HasCommitment returns true if the request has commitment configured
func (*UpdateSubscriptionLineItemRequest) ShouldCreateNewLineItem ¶ added in v1.0.30
func (r *UpdateSubscriptionLineItemRequest) ShouldCreateNewLineItem() bool
ShouldCreateNewLineItem checks if the request contains any critical fields that require creating a new line item
func (*UpdateSubscriptionLineItemRequest) ToSubscriptionLineItem ¶ added in v1.0.30
func (r *UpdateSubscriptionLineItemRequest) ToSubscriptionLineItem(ctx context.Context, existingLineItem *subscription.SubscriptionLineItem, newPriceID string) *subscription.SubscriptionLineItem
ToSubscriptionLineItem converts the update request to a domain subscription line item This method creates a new line item based on the existing one with updated parameters
func (*UpdateSubscriptionLineItemRequest) Validate ¶ added in v1.0.30
func (r *UpdateSubscriptionLineItemRequest) Validate() error
Validate validates the update subscription line item request
type UpdateSubscriptionPhaseRequest ¶ added in v1.0.38
type UpdateSubscriptionPhaseRequest struct {
// metadata contains additional key-value pairs
Metadata *types.Metadata `json:"metadata,omitempty"`
}
UpdateSubscriptionPhaseRequest represents the request to update a subscription phase Only metadata can be updated - start_date and end_date are immutable
func (*UpdateSubscriptionPhaseRequest) Validate ¶ added in v1.0.38
func (r *UpdateSubscriptionPhaseRequest) Validate() error
Validate validates the UpdateSubscriptionPhaseRequest
type UpdateSubscriptionRequest ¶
type UpdateSubscriptionRequest struct {
Status types.SubscriptionStatus `json:"status"`
CancelAt *time.Time `json:"cancel_at,omitempty"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end,omitempty"`
}
type UpdateTaskStatusRequest ¶
type UpdateTaskStatusRequest struct {
TaskStatus types.TaskStatus `json:"task_status" binding:"required"`
}
UpdateTaskStatusRequest represents a request to update a task's status
func (*UpdateTaskStatusRequest) Validate ¶
func (r *UpdateTaskStatusRequest) Validate() error
type UpdateTaxRateRequest ¶ added in v1.0.21
type UpdateTaxRateRequest struct {
// name is the updated human-readable name for the tax rate
Name string `json:"name,omitempty"`
// code is the updated unique alphanumeric identifier for the tax rate
Code string `json:"code,omitempty"`
// description is the updated text description for the tax rate
Description string `json:"description,omitempty"`
// metadata contains updated key-value pairs that will replace existing metadata
Metadata map[string]string `json:"metadata,omitempty"`
// tax_rate_type determines how the tax is calculated ("percentage" or "fixed")
TaxRateStatus *types.TaxRateStatus `json:"tax_rate_status,omitempty"`
}
UpdateTaxRateRequest represents the request to update a tax rate
func (UpdateTaxRateRequest) Validate ¶ added in v1.0.21
func (r UpdateTaxRateRequest) Validate() error
Validate validates the UpdateTaxRateRequest
type UpdateTenantRequest ¶ added in v1.0.0
type UpdateTenantRequest struct {
Name string `json:"name,omitempty"`
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
}
func (*UpdateTenantRequest) Validate ¶ added in v1.0.0
func (r *UpdateTenantRequest) Validate() error
type UpdateWalletRequest ¶
type UpdateWalletRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
AutoTopup *types.AutoTopup `json:"auto_topup,omitempty"`
Config *types.WalletConfig `json:"config,omitempty"`
AlertEnabled *bool `json:"alert_enabled,omitempty"`
AlertConfig *AlertConfig `json:"alert_config,omitempty"`
}
UpdateWalletRequest represents the request to update a wallet
func (*UpdateWalletRequest) Validate ¶
func (r *UpdateWalletRequest) Validate() error
type UsageAnalyticItem ¶ added in v1.0.17
type UsageAnalyticItem struct {
FeatureID string `json:"feature_id"`
PriceID string `json:"price_id,omitempty"` // Price ID used for this usage
MeterID string `json:"meter_id,omitempty"` // Meter ID
SubLineItemID string `json:"sub_line_item_id,omitempty"` // Subscription line item ID
SubscriptionID string `json:"subscription_id,omitempty"` // Subscription ID
Price *PriceResponse `json:"price,omitempty"` // Full price object (only if expand includes "price")
Meter *meter.Meter `json:"meter,omitempty"` // Full meter object (only if expand includes "meter")
Feature *feature.Feature `json:"feature,omitempty"` // Full feature object (only if expand includes "feature")
SubscriptionLineItem *subscription.SubscriptionLineItem `json:"subscription_line_item,omitempty"` // Full line item (only if expand includes "subscription_line_item")
Plan *plan.Plan `json:"plan,omitempty"` // Full plan object (only if expand includes "plan")
Addon *addon.Addon `json:"addon,omitempty"` // Full addon object (only if expand includes "addon")
FeatureName string `json:"name,omitempty"`
EventName string `json:"event_name,omitempty"`
Source string `json:"source,omitempty"`
Sources []string `json:"sources,omitempty"` // List of sources when not grouping by source
Unit string `json:"unit,omitempty"`
UnitPlural string `json:"unit_plural,omitempty"`
AggregationType types.AggregationType `json:"aggregation_type,omitempty"`
TotalUsage decimal.Decimal `json:"total_usage" swaggertype:"string"`
TotalCost decimal.Decimal `json:"total_cost" swaggertype:"string"`
Currency string `json:"currency,omitempty"`
EventCount uint64 `json:"event_count"` // Number of events that contributed to this aggregation
Properties map[string]string `json:"properties,omitempty"` // Stores property values for flexible grouping (e.g., org_id -> "org123")
CommitmentInfo *types.CommitmentInfo `json:"commitment_info,omitempty"`
Points []UsageAnalyticPoint `json:"points,omitempty"`
AddOnID string `json:"add_on_id,omitempty"`
PlanID string `json:"plan_id,omitempty"`
WindowSize types.WindowSize `json:"window_size,omitempty"` // Window size for bucketed meters (only set if meter is bucketed)
}
UsageAnalyticItem represents a single analytic item in the response
type UsageAnalyticPoint ¶ added in v1.0.17
type UsageAnalyticPoint struct {
Timestamp time.Time `json:"timestamp"`
Usage decimal.Decimal `json:"usage" swaggertype:"string"`
Cost decimal.Decimal `json:"cost" swaggertype:"string"`
EventCount uint64 `json:"event_count"` // Number of events in this time window
// Commitment breakdown (only populated for windowed commitments)
ComputedCommitmentUtilizedAmount decimal.Decimal `json:"computed_commitment_utilized_amount,omitempty" swaggertype:"string"`
ComputedOverageAmount decimal.Decimal `json:"computed_overage_amount,omitempty" swaggertype:"string"`
ComputedTrueUpAmount decimal.Decimal `json:"computed_true_up_amount,omitempty" swaggertype:"string"`
}
UsageAnalyticPoint represents a point in the time series data
type UsageBreakdownItem ¶ added in v1.0.23
type UsageBreakdownItem struct {
// cost is the cost attributed to this group for the line item
Cost string `json:"cost"`
// usage is the total usage amount from this group (optional, for additional context)
Usage *string `json:"usage,omitempty"`
// percentage is the percentage of total line item cost from this group (optional)
Percentage *string `json:"percentage,omitempty"`
// event_count is the number of events from this group (optional)
EventCount *int `json:"event_count,omitempty"`
// grouped_by contains the grouping field values (e.g., {"source": "api", "org_id": "org123"})
GroupedBy map[string]string `json:"grouped_by"`
}
UsageBreakdownItem represents flexible usage breakdown for any grouping within a line item
type UsageResult ¶
type UserResponse ¶
type UserResponse struct {
ID string `json:"id"`
Email string `json:"email,omitempty"` // Empty for service accounts
Type types.UserType `json:"type"`
Roles []string `json:"roles,omitempty"`
Tenant *TenantResponse `json:"tenant"`
}
func NewUserResponse ¶
func NewUserResponse(u *user.User, tenant *tenant.Tenant) *UserResponse
type ValidationError ¶ added in v1.0.21
ValidationError represents a validation error for a specific field
func (ValidationError) Error ¶ added in v1.0.21
func (e ValidationError) Error() string
type VoidOldPendingInvoicesResponse ¶ added in v1.0.29
type VoidOldPendingInvoicesResponse struct {
Items []*VoidOldPendingInvoicesResponseItem `json:"items"`
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
}
VoidOldPendingInvoicesResponse represents the response for the void old pending invoices cron job
type VoidOldPendingInvoicesResponseItem ¶ added in v1.0.29
type VoidOldPendingInvoicesResponseItem struct {
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
Count int `json:"count"`
Success int `json:"success"`
Failed int `json:"failed"`
}
VoidOldPendingInvoicesResponseItem represents the response item for each environment processed
type WalletBalanceResponse ¶
type WalletBalanceResponse struct {
*wallet.Wallet
RealTimeBalance *decimal.Decimal `json:"real_time_balance,omitempty" swaggertype:"string"`
RealTimeCreditBalance *decimal.Decimal `json:"real_time_credit_balance,omitempty" swaggertype:"string"`
BalanceUpdatedAt *time.Time `json:"balance_updated_at,omitempty"`
CurrentPeriodUsage *decimal.Decimal `json:"current_period_usage,omitempty" swaggertype:"string"`
UnpaidInvoicesAmount *decimal.Decimal `json:"unpaid_invoices_amount,omitempty" swaggertype:"string"`
CreditsAvailableBreakdown *types.CreditBreakdown `json:"credits_available_breakdown,omitempty"`
}
WalletBalanceResponse represents the response for getting wallet balance
type WalletResponse ¶
type WalletResponse struct {
*wallet.Wallet
CreditsAvailableBreakdown *types.CreditBreakdown `json:"credits_available_breakdown,omitempty"`
}
WalletResponse represents a wallet in API responses
func FromWallet ¶
func FromWallet(w *wallet.Wallet) *WalletResponse
ToWalletResponse converts domain Wallet to WalletResponse
type WalletTransactionResponse ¶
type WalletTransactionResponse struct {
*wallet.Transaction
Customer *CustomerResponse `json:"customer,omitempty"`
CreatedByUser *UserResponse `json:"created_by_user,omitempty"`
Wallet *WalletResponse `json:"wallet,omitempty"`
}
WalletTransactionResponse represents a wallet transaction in API responses
func FromWalletTransaction ¶
func FromWalletTransaction(t *wallet.Transaction) *WalletTransactionResponse
FromWalletTransaction converts a wallet transaction to a WalletTransactionResponse
func (*WalletTransactionResponse) WithWallet ¶ added in v1.0.47
func (*WalletTransactionResponse) WithWallet(w *wallet.Wallet) *WalletTransactionResponse
Source Files
¶
- addon.go
- alertlog.go
- auth.go
- common.go
- connection.go
- costsheet.go
- costsheet_analytics.go
- coupon.go
- coupon_application.go
- coupon_association.go
- creditgrant.go
- creditnote.go
- customer.go
- customer_entitlement.go
- customer_portal.go
- dashboard.go
- entitlement.go
- entityintegrationmapping.go
- environment.go
- events.go
- feature.go
- group.go
- invoice.go
- meter.go
- oauth.go
- onboarding.go
- payment.go
- payment_gateway.go
- plan.go
- price.go
- priceunit.go
- scheduled_task.go
- secret.go
- settings.go
- stripe.go
- subscription.go
- subscription_change.go
- subscription_entitlement.go
- subscription_line_item.go
- subscription_pause.go
- subscription_phase.go
- subscription_schedule.go
- task.go
- taxapplied.go
- taxassociation.go
- taxrate.go
- tenant.go
- user.go
- wallet.go