/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { AutoRechargeTriggerRequest } from '../models/AutoRechargeTriggerRequest'; import type { AutoRechargeTriggerResponse } from '../models/AutoRechargeTriggerResponse'; import type { CheckoutSessionCreate } from '../models/CheckoutSessionCreate'; import type { CheckoutSessionResponse } from '../models/CheckoutSessionResponse'; import type { CreditAccountAutoRechargeUpdate } from '../models/CreditAccountAutoRechargeUpdate'; import type { CreditAccountInfo } from '../models/CreditAccountInfo'; import type { CreditTransactionHistory } from '../models/CreditTransactionHistory'; import type { ItemAccessCheckResponse } from '../models/ItemAccessCheckResponse'; import type { ItemPaywallConfig } from '../models/ItemPaywallConfig'; import type { ItemPaywallConfigCreate } from '../models/ItemPaywallConfigCreate'; import type { ItemPrice } from '../models/ItemPrice'; import type { ItemPriceCreate } from '../models/ItemPriceCreate'; import type { ItemSubscription } from '../models/ItemSubscription'; import type { PaginatedItemPaywallConfigList } from '../models/PaginatedItemPaywallConfigList'; import type { PaginatedItemSubscriptionList } from '../models/PaginatedItemSubscriptionList'; import type { PaginatedItemSubscriptionListList } from '../models/PaginatedItemSubscriptionListList'; import type { PatchedCreditAccountAutoRechargeUpdate } from '../models/PatchedCreditAccountAutoRechargeUpdate'; import type { PlatformRevenueSummary } from '../models/PlatformRevenueSummary'; import type { PortalUrlResponse } from '../models/PortalUrlResponse'; import type { PublicItemPricing } from '../models/PublicItemPricing'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class BillingService { /** * Check whether the authenticated user has payment access to an item. * @returns ItemAccessCheckResponse * @throws ApiError */ public static billingAccessCheckRetrieve({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, /** * Platform key. Omit to resolve from request context. */ platformKey?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/access-check/{item_type}/{item_id}/', path: { 'item_id': itemId, 'item_type': itemType, }, query: { 'platform_key': platformKey, }, }); } /** * Get credit account information * Return display credits (available_credits, has_credits, account_id) and auto-recharge settings. Pass platform_key (or key) to see platform balance if you are a platform admin. * @returns CreditAccountInfo * @throws ApiError */ public static billingAccountRetrieve({ platformKey, }: { /** * The unique key of the platform to access. If not provided, defaults to 'main' (user's own account). */ platformKey?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/account/', query: { 'platform_key': platformKey, }, }); } /** * Update auto-recharge preferences * Update auto_recharge_threshold_usd, auto_recharge_amount_usd, auto_recharge_enabled, and/or auto_recharge_spending_limit_usd. When enabling auto-recharge, missing values are calculated: if only limit set, amount = 20% of limit; if only amount set, limit = 5x amount; if neither set, defaults are limit=20, amount=4. Pass platform_key in the request body to update platform settings. * @returns CreditAccountInfo * @throws ApiError */ public static billingAccountUpdate({ requestBody, }: { requestBody?: CreditAccountAutoRechargeUpdate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/billing/account/', body: requestBody, mediaType: 'application/json', }); } /** * Partially update auto-recharge preferences * Same as PUT; partial update of auto-recharge fields. * @returns CreditAccountInfo * @throws ApiError */ public static billingAccountPartialUpdate({ requestBody, }: { requestBody?: PatchedCreditAccountAutoRechargeUpdate, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/billing/account/', body: requestBody, mediaType: 'application/json', }); } /** * Trigger auto-recharge or manual top-up * With amount_usd: manual top-up (charge that amount, add credits; no threshold/limit/cooldown). Without amount_usd: run auto-recharge once if enabled and balance below threshold. Returns 400 if skipped or failed (e.g. no payment method, cooldown). Pass platform_key in request body. * @returns AutoRechargeTriggerResponse * @throws ApiError */ public static billingAutoRechargeTriggerCreate({ requestBody, }: { requestBody?: AutoRechargeTriggerRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/auto-recharge/trigger/', body: requestBody, mediaType: 'application/json', }); } /** * Check whether the authenticated user has payment access to an item. * @returns ItemAccessCheckResponse * @throws ApiError */ public static billingItemsAccessCheckRetrieve({ itemUniqueId, platformKey, }: { itemUniqueId: string, /** * Platform key. Omit to resolve from request context. */ platformKey?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/access-check/', path: { 'item_unique_id': itemUniqueId, }, query: { 'platform_key': platformKey, }, }); } /** * Create checkout session * Create a Stripe checkout session for an authenticated user to purchase or subscribe to an item. * @returns CheckoutSessionResponse * @throws ApiError */ public static billingItemsCheckoutCreate({ itemUniqueId, requestBody, }: { itemUniqueId: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/{item_unique_id}/checkout/', path: { 'item_unique_id': itemUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Handle checkout callback * Stripe redirects here after checkout. Processes the completed session and redirects to the return URL. * @returns void * @throws ApiError */ public static billingItemsCheckoutCallbackRetrieve({ itemUniqueId, returnUrl, }: { itemUniqueId: string, returnUrl?: string | null, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/checkout-callback/', path: { 'item_unique_id': itemUniqueId, }, query: { 'return_url': returnUrl, }, errors: { 302: `No response body`, }, }); } /** * Handle checkout callback * Stripe redirects here after checkout. Processes the completed session and redirects to the return URL. * @returns void * @throws ApiError */ public static billingItemsCheckoutCallbackRetrieve2({ checkoutSessionId, itemUniqueId, returnUrl, }: { checkoutSessionId: string, itemUniqueId: string, returnUrl?: string | null, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/checkout-callback/{checkout_session_id}/', path: { 'checkout_session_id': checkoutSessionId, 'item_unique_id': itemUniqueId, }, query: { 'return_url': returnUrl, }, errors: { 302: `No response body`, }, }); } /** * Create guest checkout session * Create a Stripe checkout session for a guest user (email required). * @returns CheckoutSessionResponse * @throws ApiError */ public static billingItemsCheckoutGuestCreate({ itemUniqueId, requestBody, }: { itemUniqueId: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/{item_unique_id}/checkout-guest/', path: { 'item_unique_id': itemUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Get paywall configuration * Retrieve the paywall configuration for an item. Returns default (disabled) config if none exists. * @returns ItemPaywallConfig * @throws ApiError */ public static billingItemsPaywallRetrieve({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/paywall/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Create or update paywall configuration * Enable or configure the paywall for an item. Creates a Stripe product on first enable. * @returns ItemPaywallConfig * @throws ApiError */ public static billingItemsPaywallCreate({ itemUniqueId, requestBody, }: { itemUniqueId: string, requestBody?: ItemPaywallConfigCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/{item_unique_id}/paywall/', path: { 'item_unique_id': itemUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Update paywall configuration * Same as POST. Update the paywall configuration for an item. * @returns ItemPaywallConfig * @throws ApiError */ public static billingItemsPaywallUpdate({ itemUniqueId, requestBody, }: { itemUniqueId: string, requestBody?: ItemPaywallConfigCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/billing/items/{item_unique_id}/paywall/', path: { 'item_unique_id': itemUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Disable paywall configuration * Disable the paywall for an item. Does not delete the configuration. * @returns void * @throws ApiError */ public static billingItemsPaywallDestroy({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/billing/items/{item_unique_id}/paywall/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * List prices * List active prices for an item's paywall configuration. * @returns ItemPrice * @throws ApiError */ public static billingItemsPaywallPricesList({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/paywall/prices/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Create a price * Create a new price tier for an item. Requires paywall to be enabled and Stripe Connect account ready. * @returns ItemPrice * @throws ApiError */ public static billingItemsPaywallPricesCreate({ itemUniqueId, requestBody, }: { itemUniqueId: string, requestBody: ItemPriceCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/{item_unique_id}/paywall/prices/', path: { 'item_unique_id': itemUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Get public pricing * Retrieve public pricing information for an item. No authentication required. * @returns PublicItemPricing * @throws ApiError */ public static billingItemsPricingRetrieve({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/pricing/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Get public pricing * Retrieve public pricing information for an item. No authentication required. * @returns PublicItemPricing * @throws ApiError */ public static billingItemsPublicPricingRetrieve({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/public-pricing/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Check whether the authenticated user has payment access to an item on a scoped platform. * @returns ItemAccessCheckResponse * @throws ApiError */ public static billingItemsScopedAccessCheckRetrieve({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/scoped-access-check/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * List item subscribers * List all subscribers for an item. Optionally filter by subscription status. * @returns PaginatedItemSubscriptionList * @throws ApiError */ public static billingItemsSubscribersList({ itemUniqueId, page, pageSize, search, status, }: { itemUniqueId: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, search?: string, /** * * `active` - Active * * `free` - Free Tier * * `grandfathered` - Grandfathered * * `trialing` - Trialing * * `past_due` - Past Due * * `canceled` - Canceled * * `incomplete` - Incomplete */ status?: 'active' | 'free' | 'grandfathered' | 'trialing' | 'past_due' | 'canceled' | 'incomplete', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/subscribers/', path: { 'item_unique_id': itemUniqueId, }, query: { 'page': page, 'page_size': pageSize, 'search': search, 'status': status, }, }); } /** * Get user subscription * Retrieve the current user's subscription to an item. * @returns ItemSubscription * @throws ApiError */ public static billingItemsSubscriptionRetrieve({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/{item_unique_id}/subscription/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Cancel subscription * Cancel the current user's subscription. Returns a Stripe customer portal URL for recurring subscriptions, or cancels directly for one-time purchases. * @returns PortalUrlResponse * @throws ApiError */ public static billingItemsSubscriptionCancelCreate({ itemUniqueId, }: { itemUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/{item_unique_id}/subscription/cancel/', path: { 'item_unique_id': itemUniqueId, }, }); } /** * Get price details * Retrieve a specific price by ID. * @returns ItemPrice * @throws ApiError */ public static billingItemsPricesRetrieve({ priceUniqueId, }: { priceUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/items/prices/{price_unique_id}/', path: { 'price_unique_id': priceUniqueId, }, }); } /** * Update a price * Update a price tier. If pricing fields change and a Stripe price exists, a new Stripe price is created and the old one deactivated. * @returns ItemPrice * @throws ApiError */ public static billingItemsPricesUpdate({ priceUniqueId, requestBody, }: { priceUniqueId: string, requestBody: ItemPriceCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/billing/items/prices/{price_unique_id}/', path: { 'price_unique_id': priceUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Delete a price * Soft-delete a price tier and deactivate the corresponding Stripe price. * @returns void * @throws ApiError */ public static billingItemsPricesDestroy({ priceUniqueId, }: { priceUniqueId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/billing/items/prices/{price_unique_id}/', path: { 'price_unique_id': priceUniqueId, }, }); } /** * Create checkout session * Create a Stripe checkout session for an authenticated user to purchase or subscribe to an item. * @returns CheckoutSessionResponse * @throws ApiError */ public static billingItemsPricesCheckoutCreate({ priceUniqueId, requestBody, }: { priceUniqueId: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/items/prices/{price_unique_id}/checkout/', path: { 'price_unique_id': priceUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * Check whether the authenticated user has payment access to an item on a scoped platform. * @returns ItemAccessCheckResponse * @throws ApiError */ public static billingPlatformsItemsAccessCheckRetrieve({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/access-check/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * Create checkout session * Create a Stripe checkout session for an authenticated user to purchase or subscribe to an item. * @returns CheckoutSessionResponse * @throws ApiError */ public static billingPlatformsItemsCheckoutCreate({ itemId, itemType, platformKey, requestBody, }: { itemId: string, itemType: string, platformKey: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/checkout/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Handle checkout callback * Stripe redirects here after checkout. Processes the completed session and redirects to the return URL. * @returns void * @throws ApiError */ public static billingPlatformsItemsCheckoutCallbackRetrieve({ itemId, itemType, platformKey, returnUrl, }: { itemId: string, itemType: string, platformKey: string, returnUrl?: string | null, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/checkout-callback/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, query: { 'return_url': returnUrl, }, errors: { 302: `No response body`, }, }); } /** * Handle checkout callback * Stripe redirects here after checkout. Processes the completed session and redirects to the return URL. * @returns void * @throws ApiError */ public static billingPlatformsItemsCheckoutCallbackRetrieve2({ checkoutSessionId, itemId, itemType, platformKey, returnUrl, }: { checkoutSessionId: string, itemId: string, itemType: string, platformKey: string, returnUrl?: string | null, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/checkout-callback/{checkout_session_id}/', path: { 'checkout_session_id': checkoutSessionId, 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, query: { 'return_url': returnUrl, }, errors: { 302: `No response body`, }, }); } /** * Create guest checkout session * Create a Stripe checkout session for a guest user (email required). * @returns CheckoutSessionResponse * @throws ApiError */ public static billingPlatformsItemsCheckoutGuestCreate({ itemId, itemType, platformKey, requestBody, }: { itemId: string, itemType: string, platformKey: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/checkout-guest/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Get paywall configuration * Retrieve the paywall configuration for an item. Returns default (disabled) config if none exists. * @returns ItemPaywallConfig * @throws ApiError */ public static billingPlatformsItemsPaywallRetrieve({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * Create or update paywall configuration * Enable or configure the paywall for an item. Creates a Stripe product on first enable. * @returns ItemPaywallConfig * @throws ApiError */ public static billingPlatformsItemsPaywallCreate({ itemId, itemType, platformKey, requestBody, }: { itemId: string, itemType: string, platformKey: string, requestBody?: ItemPaywallConfigCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Update paywall configuration * Same as POST. Update the paywall configuration for an item. * @returns ItemPaywallConfig * @throws ApiError */ public static billingPlatformsItemsPaywallUpdate({ itemId, itemType, platformKey, requestBody, }: { itemId: string, itemType: string, platformKey: string, requestBody?: ItemPaywallConfigCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Disable paywall configuration * Disable the paywall for an item. Does not delete the configuration. * @returns void * @throws ApiError */ public static billingPlatformsItemsPaywallDestroy({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * List prices * List active prices for an item's paywall configuration. * @returns ItemPrice * @throws ApiError */ public static billingPlatformsItemsPaywallPricesList({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/prices/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * Create a price * Create a new price tier for an item. Requires paywall to be enabled and Stripe Connect account ready. * @returns ItemPrice * @throws ApiError */ public static billingPlatformsItemsPaywallPricesCreate({ itemId, itemType, platformKey, requestBody, }: { itemId: string, itemType: string, platformKey: string, requestBody: ItemPriceCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/prices/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Get price details * Retrieve a specific price by ID. * @returns ItemPrice * @throws ApiError */ public static billingPlatformsItemsPaywallPricesRetrieve({ itemId, itemType, platformKey, priceId, }: { itemId: string, itemType: string, platformKey: string, priceId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/prices/{price_id}/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, 'price_id': priceId, }, }); } /** * Update a price * Update a price tier. If pricing fields change and a Stripe price exists, a new Stripe price is created and the old one deactivated. * @returns ItemPrice * @throws ApiError */ public static billingPlatformsItemsPaywallPricesUpdate({ itemId, itemType, platformKey, priceId, requestBody, }: { itemId: string, itemType: string, platformKey: string, priceId: string, requestBody: ItemPriceCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/prices/{price_id}/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, 'price_id': priceId, }, body: requestBody, mediaType: 'application/json', }); } /** * Delete a price * Soft-delete a price tier and deactivate the corresponding Stripe price. * @returns void * @throws ApiError */ public static billingPlatformsItemsPaywallPricesDestroy({ itemId, itemType, platformKey, priceId, }: { itemId: string, itemType: string, platformKey: string, priceId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/paywall/prices/{price_id}/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, 'price_id': priceId, }, }); } /** * Get public pricing * Retrieve public pricing information for an item. No authentication required. * @returns PublicItemPricing * @throws ApiError */ public static billingPlatformsItemsPricingRetrieve({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/pricing/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * List item subscribers * List all subscribers for an item. Optionally filter by subscription status. * @returns PaginatedItemSubscriptionList * @throws ApiError */ public static billingPlatformsItemsSubscribersList({ itemId, itemType, platformKey, page, pageSize, search, status, }: { itemId: string, itemType: string, platformKey: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, search?: string, /** * * `active` - Active * * `free` - Free Tier * * `grandfathered` - Grandfathered * * `trialing` - Trialing * * `past_due` - Past Due * * `canceled` - Canceled * * `incomplete` - Incomplete */ status?: 'active' | 'free' | 'grandfathered' | 'trialing' | 'past_due' | 'canceled' | 'incomplete', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/subscribers/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, query: { 'page': page, 'page_size': pageSize, 'search': search, 'status': status, }, }); } /** * Get user subscription * Retrieve the current user's subscription to an item. * @returns ItemSubscription * @throws ApiError */ public static billingPlatformsItemsSubscriptionRetrieve({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/subscription/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * Cancel subscription * Cancel the current user's subscription. Returns a Stripe customer portal URL for recurring subscriptions, or cancels directly for one-time purchases. * @returns PortalUrlResponse * @throws ApiError */ public static billingPlatformsItemsSubscriptionCancelCreate({ itemId, itemType, platformKey, }: { itemId: string, itemType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/platforms/{platform_key}/items/{item_type}/{item_id}/subscription/cancel/', path: { 'item_id': itemId, 'item_type': itemType, 'platform_key': platformKey, }, }); } /** * List user subscriptions * Paginated list of the current user's subscriptions on a platform. Optionally filter by status or item_type. * @returns PaginatedItemSubscriptionListList * @throws ApiError */ public static billingPlatformsMySubscriptionsList({ platformKey, itemType, page, pageSize, search, status, }: { platformKey: string, itemType?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, search?: string, /** * * `active` - Active * * `free` - Free Tier * * `grandfathered` - Grandfathered * * `trialing` - Trialing * * `past_due` - Past Due * * `canceled` - Canceled * * `incomplete` - Incomplete */ status?: 'active' | 'free' | 'grandfathered' | 'trialing' | 'past_due' | 'canceled' | 'incomplete', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/my-subscriptions/', path: { 'platform_key': platformKey, }, query: { 'item_type': itemType, 'page': page, 'page_size': pageSize, 'search': search, 'status': status, }, }); } /** * List all platform paywall configurations * Paginated list of all item paywall configurations on a platform. Filterable by item_type and is_enabled. * @returns PaginatedItemPaywallConfigList * @throws ApiError */ public static billingPlatformsPaywallsList({ platformKey, isEnabled, itemType, page, pageSize, search, }: { platformKey: string, isEnabled?: boolean | null, itemType?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, search?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/paywalls/', path: { 'platform_key': platformKey, }, query: { 'is_enabled': isEnabled, 'item_type': itemType, 'page': page, 'page_size': pageSize, 'search': search, }, }); } /** * Platform sales summary * Aggregate sales volume and count for a platform across all item types. * @returns PlatformRevenueSummary * @throws ApiError */ public static billingPlatformsRevenueRetrieve({ platformKey, }: { platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/revenue/', path: { 'platform_key': platformKey, }, }); } /** * List all platform subscribers * Paginated list of all subscribers across all items on a platform. Filterable by status and item_type. * @returns PaginatedItemSubscriptionListList * @throws ApiError */ public static billingPlatformsSubscribersList({ platformKey, itemType, page, pageSize, search, status, }: { platformKey: string, itemType?: string, /** * A page number within the paginated result set. */ page?: number, /** * Number of results to return per page. */ pageSize?: number, search?: string, /** * * `active` - Active * * `free` - Free Tier * * `grandfathered` - Grandfathered * * `trialing` - Trialing * * `past_due` - Past Due * * `canceled` - Canceled * * `incomplete` - Incomplete */ status?: 'active' | 'free' | 'grandfathered' | 'trialing' | 'past_due' | 'canceled' | 'incomplete', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/platforms/{platform_key}/subscribers/', path: { 'platform_key': platformKey, }, query: { 'item_type': itemType, 'page': page, 'page_size': pageSize, 'search': search, 'status': status, }, }); } /** * Create guest checkout session by price unique_id * Looks up the price by its unique_id, derives platform/item_type/item_id, and delegates to the standard guest checkout flow. * @returns CheckoutSessionResponse * @throws ApiError */ public static billingPricesCheckoutGuestCreate({ priceUniqueId, requestBody, }: { priceUniqueId: string, requestBody?: CheckoutSessionCreate, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/billing/prices/{price_unique_id}/checkout-guest/', path: { 'price_unique_id': priceUniqueId, }, body: requestBody, mediaType: 'application/json', }); } /** * List transaction history * Paginated transaction history for the credit account. Use platform_key query param to list platform account transactions (if permitted). Filter by transaction_type, from_date (YYYY-MM-DD), to_date (YYYY-MM-DD). * @returns CreditTransactionHistory * @throws ApiError */ public static billingTransactionsRetrieve({ fromDate, platformKey, toDate, transactionType, }: { /** * Filter from date (YYYY-MM-DD), inclusive. */ fromDate?: string, /** * Platform key. Omit for user's own account. */ platformKey?: string, /** * Filter to date (YYYY-MM-DD), inclusive. */ toDate?: string, /** * Filter by transaction type. * * * `add` - add * * `subtract` - subtract * * `reserve` - reserve * * `release` - release * * `rollover` - rollover * * `refund` - refund */ transactionType?: 'add' | 'subtract' | 'reserve' | 'release' | 'rollover' | 'refund', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/billing/transactions/', query: { 'from_date': fromDate, 'platform_key': platformKey, 'to_date': toDate, 'transaction_type': transactionType, }, }); } }