Subscription data model

Updated:

View field support, webhooks, and list parameters for each integration on the Supported Integrations page.

FieldTypeRequiredDescription
idstringNo
created_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
updated_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
descriptionstringNo
contact_idstringNoa reference to an Accounting Contact (reference to AccountingContact)
invoice_idstringNoa reference to an Accounting Invoice (reference to AccountingInvoice)
current_period_end_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
current_period_start_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
canceled_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
currencystringNo
total_amountnumberNo
start_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
end_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
statusenumNoValues: ACTIVE, INACTIVE, CANCELED, PAUSED
monthnumberNothe month on which to charge a customer (1-12). Only applies when the interval_unit is YEAR.
interval_unitenumNoValues: YEAR, MONTH, WEEK, DAY
day_of_monthnumberNoThe day of the month to charge customers on. 1-28 or -1 to indicate the last day of the month. Only applies when the interval_unit is MONTH.
day_of_weeknumberNoThe day of the week to charge customers on. 1-7 or -1 to indicate the last day of the week. Only applies when the interval_unit is WEEK.
intervalnumberNoThe number of intervals between charges within the interval_unit. Defaults to 1.
lineitemsPaymentLineitem[]No
lineitems[].idstringNo
lineitems[].created_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
lineitems[].updated_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
lineitems[].refunded_atstring (date-time)No(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
lineitems[].total_amountnumberNo
lineitems[].refund_amountnumberNonew field
lineitems[].discount_amountnumberNo
lineitems[].tax_amountnumberNo
lineitems[].item_idstringNo(reference to CommerceItem)
lineitems[].unit_amountnumberNo
lineitems[].unit_quantitynumberNo
lineitems[].item_skustringNo
lineitems[].item_namestringNo
lineitems[].item_descriptionstringNo
lineitems[].notesstringNo
lineitems[].taxrate_idstringNo
lineitems[].account_idstringNo(reference to AccountingAccount)
metadataPaymentMetadata[]No
metadata[].idstringNo
metadata[].slugstringNo
metadata[].valueobjectNo
metadata[].namespacestringNo
metadata[].formatenumNoValues: TEXT, NUMBER, DATE, BOOLEAN, FILE, TEXTAREA, SINGLE_SELECT, MULTIPLE_SELECT, MEASUREMENT, PRICE, YES_NO, CURRENCY, URL
metadata[].extra_dataobjectNo

TypeScript

TypeScript
export type PaymentSubscription = {
	id?: string;
	created_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	updated_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	description?: string;
	contact_id?: string; // a reference to an Accounting Contact (reference to AccountingContact)
	invoice_id?: string; // a reference to an Accounting Invoice (reference to AccountingInvoice)
	current_period_end_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	current_period_start_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	canceled_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	currency?: string;
	total_amount?: number;
	start_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	end_at?: string-time; // (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	status?: 'ACTIVE' | 'INACTIVE' | 'CANCELED' | 'PAUSED';
	month?: number; // the month on which to charge a customer (1-12). Only applies when the interval_unit is YEAR.
	interval_unit?: 'YEAR' | 'MONTH' | 'WEEK' | 'DAY';
	day_of_month?: number; // The day of the month to charge customers on. 1-28 or -1 to indicate the last day of the month. Only applies when the interval_unit is MONTH.
	day_of_week?: number; // The day of the week to charge customers on. 1-7 or -1 to indicate the last day of the week. Only applies when the interval_unit is WEEK.
	interval?: number; // The number of intervals between charges within the interval_unit. Defaults to 1.
	lineitems?: [];
	metadata?: [];
	raw?: any;
} 

Zod

Zod
import { z } from 'zod';

export const ZodPaymentSubscription = z.object({
	id: z.string().optional(),
	created_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	updated_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	description: z.string().optional(),
	contact_id: z.string().optional().describe("a reference to an Accounting Contact (reference to AccountingContact)"),
	invoice_id: z.string().optional().describe("a reference to an Accounting Invoice (reference to AccountingInvoice)"),
	current_period_end_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	current_period_start_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	canceled_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	currency: z.string().optional(),
	total_amount: z.number().optional(),
	start_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	end_at: z.string-time().optional().describe("(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	status: z.enum("ACTIVE", "INACTIVE", "CANCELED", "PAUSED").optional(),
	month: z.number().optional().describe("the month on which to charge a customer (1-12). Only applies when the interval_unit is YEAR."),
	interval_unit: z.enum("YEAR", "MONTH", "WEEK", "DAY").optional(),
	day_of_month: z.number().optional().describe("The day of the month to charge customers on. 1-28 or -1 to indicate the last day of the month. Only applies when the interval_unit is MONTH."),
	day_of_week: z.number().optional().describe("The day of the week to charge customers on. 1-7 or -1 to indicate the last day of the week. Only applies when the interval_unit is WEEK."),
	interval: z.number().optional().describe("The number of intervals between charges within the interval_unit. Defaults to 1."),
	lineitems: z.array().optional(),
	metadata: z.array().optional(),

});

Python

Python
import dataclasses

@dataclasses.dataclass
class PaymentSubscriptionStatus(str, Enum):
	ACTIVE = 'ACTIVE'
	INACTIVE = 'INACTIVE'
	CANCELED = 'CANCELED'
	PAUSED = 'PAUSED'

@dataclasses.dataclass
class PaymentSubscriptionInterval_unit(str, Enum):
	YEAR = 'YEAR'
	MONTH = 'MONTH'
	WEEK = 'WEEK'
	DAY = 'DAY'

@dataclasses.dataclass
class PaymentSubscription:
	id: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	created_at: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	updated_at: Optional[str]
	description: Optional[str]
	"""a reference to an Accounting Contact (reference to AccountingContact)"""
	contact_id: Optional[str]
	"""a reference to an Accounting Invoice (reference to AccountingInvoice)"""
	invoice_id: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	current_period_end_at: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	current_period_start_at: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	canceled_at: Optional[str]
	currency: Optional[str]
	total_amount: Optional[int]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	start_at: Optional[str]
	"""(ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	end_at: Optional[str]
	status: Optional[PaymentSubscriptionStatus]
	"""the month on which to charge a customer (1-12). Only applies when the interval_unit is YEAR."""
	month: Optional[int]
	interval_unit: Optional[PaymentSubscriptionInterval_unit]
	"""The day of the month to charge customers on. 1-28 or -1 to indicate the last day of the month. Only applies when the interval_unit is MONTH."""
	day_of_month: Optional[int]
	"""The day of the week to charge customers on. 1-7 or -1 to indicate the last day of the week. Only applies when the interval_unit is WEEK."""
	day_of_week: Optional[int]
	"""The number of intervals between charges within the interval_unit. Defaults to 1."""
	interval: Optional[int]
	lineitems: Optional[PropertyPaymentSubscriptionLineitems]
	metadata: Optional[PropertyPaymentSubscriptionMetadata]
Are we missing anything? Let us know
Was this page helpful?