Documentation
¶
Index ¶
- Variables
- type PaymentCancelSubscriptionInput
- type PaymentCheckoutInput
- type PaymentEntitlementQuery
- type PaymentEntitlementResponse
- type PaymentEvent
- type PaymentEventResponse
- type PaymentHistoryQuery
- type PaymentModuleMigration
- type PaymentPortalInput
- type PaymentPriceOption
- type PaymentProviderStatus
- type PaymentStatus
- type PaymentStoreVerificationInput
- type PaymentSubscription
- type PaymentSubscriptionCheckoutInput
- type PaymentSubscriptionQuery
- type PaymentSubscriptionResponse
- type PaymentWebhookEvent
- type PaymentWebhookListQuery
- type PaymentWebhookResponse
- type PaymentWebhookRetryInput
- type SubscriptionStatus
- type WebhookStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPaymentOwnershipConflict = errors.New("payment resource belongs to another identity") ErrPaymentProductRejected = errors.New("payment product is not allowed") ErrPaymentIdempotencyKey = errors.New("valid idempotency key is required") ErrPaymentWebhookLeaseLost = errors.New("payment webhook processing lease was lost") )
Functions ¶
This section is empty.
Types ¶
type PaymentCheckoutInput ¶
type PaymentCheckoutInput struct {
Provider string `json:"provider" validate:"required,max=32"`
PriceID string `json:"price_id" validate:"required,max=191"`
SuccessURL string `json:"success_url" validate:"required,url,max=2048"`
CancelURL string `json:"cancel_url" validate:"required,url,max=2048"`
IdempotencyKey string `json:"-" validate:"required,max=255"`
}
type PaymentEntitlementQuery ¶ added in v0.3.0
type PaymentEntitlementQuery struct {
PlanCode string `query:"plan_code" validate:"omitempty,max=191"`
}
type PaymentEntitlementResponse ¶ added in v0.3.0
type PaymentEvent ¶
type PaymentEvent struct {
ID uint `gorm:"primaryKey"`
Provider string `gorm:"size:32;not null;uniqueIndex:idx_payment_provider_external,priority:1;index"`
ExternalID string `gorm:"size:191;not null;uniqueIndex:idx_payment_provider_external,priority:2"`
IdentityID string `gorm:"size:191;index"`
CustomerID string `gorm:"size:191;index"`
SubscriptionID string `gorm:"size:191;index"`
PriceID string `gorm:"size:191;index"`
Status PaymentStatus `gorm:"size:32;not null;index"`
Kind string `gorm:"size:32;not null;index"`
AmountMinor int64 `gorm:"not null;default:0"`
Currency string `gorm:"size:8"`
OccurredAt time.Time `gorm:"not null;index"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (PaymentEvent) TableName ¶
func (PaymentEvent) TableName() string
type PaymentEventResponse ¶ added in v0.3.0
type PaymentEventResponse struct {
Provider string `json:"provider"`
ExternalID string `json:"external_id"`
SubscriptionID string `json:"subscription_id,omitempty"`
PlanCode string `json:"plan_code,omitempty"`
Status PaymentStatus `json:"status"`
Kind string `json:"kind"`
AmountMinor int64 `json:"amount_minor"`
Currency string `json:"currency"`
OccurredAt time.Time `json:"occurred_at"`
}
type PaymentHistoryQuery ¶ added in v0.3.0
type PaymentModuleMigration ¶ added in v0.3.0
func (PaymentModuleMigration) TableName ¶ added in v0.3.0
func (PaymentModuleMigration) TableName() string
type PaymentPortalInput ¶
type PaymentPriceOption ¶
type PaymentPriceOption struct {
ID string `json:"id"`
AmountMinor int64 `json:"amount_minor"`
Currency string `json:"currency"`
Description string `json:"description"`
Kind string `json:"kind"`
Interval string `json:"interval,omitempty"`
ProductID string `json:"product_id,omitempty"`
ProductName string `json:"product_name,omitempty"`
}
type PaymentProviderStatus ¶ added in v0.3.0
type PaymentStatus ¶
type PaymentStatus string
const ( PaymentStatusPending PaymentStatus = "PENDING" PaymentStatusSucceeded PaymentStatus = "SUCCEEDED" PaymentStatusFailed PaymentStatus = "FAILED" PaymentStatusCanceled PaymentStatus = "CANCELED" PaymentStatusRefunded PaymentStatus = "REFUNDED" PaymentStatusDisputed PaymentStatus = "DISPUTED" )
type PaymentStoreVerificationInput ¶
type PaymentStoreVerificationInput struct {
PackageName string `json:"package_name,omitempty" validate:"omitempty,max=255"`
ProductID string `json:"product_id" validate:"required_without=SignedPayload,max=191"`
PurchaseToken string `json:"purchase_token" validate:"required_without=SignedPayload,max=4096"`
SignedPayload string `json:"signed_payload" validate:"required_without=PurchaseToken,max=262144"`
}
type PaymentSubscription ¶
type PaymentSubscription struct {
ID uint `gorm:"primaryKey"`
Provider string `gorm:"size:32;not null;uniqueIndex:idx_subscription_provider_external,priority:1;index"`
ExternalSubscriptionID string `gorm:"size:191;not null;uniqueIndex:idx_subscription_provider_external,priority:2"`
IdentityID string `gorm:"size:191;not null;index"`
CustomerID string `gorm:"size:191;index"`
PlanCode string `gorm:"size:191;index"`
Status SubscriptionStatus `gorm:"size:32;not null;index"`
CurrentPeriodStart time.Time `gorm:"index"`
CurrentPeriodEnd time.Time `gorm:"index"`
CancelAt *time.Time `gorm:"index"`
CancelAtPeriodEnd bool `gorm:"not null;default:false"`
ProviderData string `gorm:"type:text" json:"-"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (PaymentSubscription) TableName ¶
func (PaymentSubscription) TableName() string
type PaymentSubscriptionCheckoutInput ¶
type PaymentSubscriptionCheckoutInput struct {
Provider string `json:"provider" validate:"required,max=32"`
PriceID string `json:"price_id" validate:"required,max=191"`
SuccessURL string `json:"success_url" validate:"required,url,max=2048"`
CancelURL string `json:"cancel_url" validate:"required,url,max=2048"`
IdempotencyKey string `json:"-" validate:"required,max=255"`
}
type PaymentSubscriptionQuery ¶ added in v0.3.0
type PaymentSubscriptionResponse ¶
type PaymentSubscriptionResponse struct {
Provider string `json:"provider"`
SubscriptionID string `json:"subscription_id"`
PlanCode string `json:"plan_code"`
Status SubscriptionStatus `json:"status"`
CurrentPeriodStart time.Time `json:"current_period_start"`
CurrentPeriodEnd time.Time `json:"current_period_end"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end"`
}
type PaymentWebhookEvent ¶
type PaymentWebhookEvent struct {
ID uint `gorm:"primaryKey"`
Provider string `gorm:"size:32;not null;uniqueIndex:idx_webhook_provider_event,priority:1"`
EventID string `gorm:"size:191;not null;uniqueIndex:idx_webhook_provider_event,priority:2"`
EventType string `gorm:"size:100;not null;index"`
Status WebhookStatus `gorm:"size:20;not null;default:PROCESSING;index"`
Attempts int `gorm:"not null;default:1"`
Payload []byte `json:"-"`
Signature string `gorm:"type:text" json:"-"`
LeaseID string `gorm:"size:64;index" json:"-"`
ProcessingStartedAt *time.Time `gorm:"index"`
LastAttemptAt *time.Time `gorm:"index"`
ProcessedAt *time.Time `gorm:"index"`
LastError string `gorm:"type:text"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (PaymentWebhookEvent) TableName ¶
func (PaymentWebhookEvent) TableName() string
type PaymentWebhookListQuery ¶ added in v0.3.0
type PaymentWebhookResponse ¶ added in v0.3.0
type PaymentWebhookResponse struct {
Provider string `json:"provider"`
EventID string `json:"event_id"`
EventType string `json:"event_type"`
Status WebhookStatus `json:"status"`
Attempts int `json:"attempts"`
LastError string `json:"last_error,omitempty"`
LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"`
ProcessedAt *time.Time `json:"processed_at,omitempty"`
}
type PaymentWebhookRetryInput ¶ added in v0.3.0
type SubscriptionStatus ¶
type SubscriptionStatus string
const ( SubscriptionStatusActive SubscriptionStatus = "ACTIVE" SubscriptionStatusTrialing SubscriptionStatus = "TRIALING" SubscriptionStatusPastDue SubscriptionStatus = "PAST_DUE" SubscriptionStatusCanceled SubscriptionStatus = "CANCELED" SubscriptionStatusExpired SubscriptionStatus = "EXPIRED" SubscriptionStatusRefunded SubscriptionStatus = "REFUNDED" SubscriptionStatusRevoked SubscriptionStatus = "REVOKED" )
type WebhookStatus ¶ added in v0.3.0
type WebhookStatus string
const ( WebhookStatusProcessing WebhookStatus = "PROCESSING" WebhookStatusSucceeded WebhookStatus = "SUCCEEDED" WebhookStatusFailed WebhookStatus = "FAILED" )
Click to show internal directories.
Click to hide internal directories.