User

Properties

PropertyTypeDescription
emailstringEmail address of the user.
paidbooleanTrue if the user has at least one active plan or a lifetime plan.
plansUserPlan[]Array of plans the user has purchased.
credits_leftnumberRemaining credits for the user.

Example

{
    email: "user@example.com",
	paid: true,
	plans: [
		{
			id: "plan_12345",
			name: "Pro Plan",
			price: 1999,
			credits: 100,
			description: "The Pro Plan gives you access to all features.",
			billing_cycle: "monthly",

			status: "active",
			paid_at: "2023-10-01T12:00:00Z",
			canceled_at: null,
		},
        ...
	],
	credits_left: 50
}

Plan

Properties

PropertyTypeDescription
idstringUnique identifier for the plan.
namestringName of the plan.
pricenumberPrice in cents (e.g., 1000 for $10.00).
creditsnumber | nullNumber of credits included in the plan, null if not applicable.
descriptionstring | nullDescription of the plan, null if not applicable.
billing_cyclestringBilling cycle, one of once, monthly, or yearly.

Examples

{
    id: "plan_12345",
    name: "Pro Plan",
    price: 1999, // $19.99
    credits: 100,
    description: "Access to all premium features and 100 credits.",
    billing_cycle: "monthly"
}
{
    id: "plan_67890",
    name: "Lifetime Plan",
    price: 9999, // $99.99
    credits: null, // No credits included
    description: "One-time purchase for lifetime access.",
    billing_cycle: "once"
}

UserPlan

Properties

PropertyTypeDescription
idstringUnique identifier for the plan.
namestringName of the plan.
pricenumberPrice in cents (e.g., 1000 for $10.00).
creditsnumber | nullNumber of credits included in the plan, null if not applicable.
descriptionstring | nullDescription of the plan, null if not applicable.
billing_cyclestringBilling cycle, one of once, monthly, or yearly.
statusstringOne of active, past_due or canceled
paid_atstring | nullThe date when the plan was paid/resubscribed.
canceled_atstring | nullThe date when the plan was canceled.

Examples

{

    id: "plan_67890",
    name: "Lifetime Plan",
    price: 9999, // $99.99
    credits: null, // No credits included
    description: "One-time purchase for lifetime access.",
    billing_cycle: "once"

    status: "active",
    paid_at: "2023-10-01T12:00:00Z",
    canceled_at: null,
}
{
    id: "plan_12345",
    name: "Pro Plan",
    price: 1999, // $19.99
    credits: 100,
    description: "Access to all premium features and 100 credits.",
    billing_cycle: "monthly"

    status: "canceled",
    paid_at: "2023-10-01T12:00:00Z",
    canceled_at: "2023-10-15T12:00:00Z",
}
{
    ...
    status: "past_due",
    paid_at: null,
    canceled_at: null,
}

UseCreditsResult

Properties

PropertyTypeDescription
successbooleantrue if credits were consumed
credits_leftnumberRemaining credits for user

Examples

{
    success: true,
    credits_left: 50
}
{
    success: false,
    credits_left: 0
}