import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as Whop from "../../../index.js"; export declare namespace MembershipsClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } /** * A Membership is a customer's purchase of a variant: the subscription or one-time grant that gives them access to a product. It tracks billing state (`active`, `trialing`, `past_due`, and so on), the current period, pending cancellations, custom metadata, and the software license key when the product includes licensing. * * Use the Memberships API to list an account's memberships or your own, retrieve one by ID or license key, invite a recipient to join through a free variant, and manage the lifecycle: cancel immediately or at period end, reverse a scheduled cancellation, pause and resume payment collection, extend or reactivate access, apply a promo code or affiliate, change renewal cadence, resync access, generate a transfer link, and update metadata. */ export declare class MembershipsClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: MembershipsClient.Options); /** * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. `account_id` and `user_id` only narrow that list — values outside the caller's reach return fewer results, not an error. * * @param {Whop.ListMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.list({ * external_account: "discord_123456789012345678", * product_ids: ["prod_xxxxxxxxxxxxx"], * variant_ids: ["plan_xxxxxxxxxxxxx"], * promo_code_ids: ["promo_xxxxxxxxxxxxxx"] * }) */ list(request?: Whop.ListMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): Promise>; /** * Emails one recipient an invitation to a free variant's membership. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. * * @param {Whop.InviteMembershipsRequestBody} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.invite({ * user_id: "user_xxxxxxxxxxxxxx", * variant_id: "plan_xxxxxxxxxxxxxx" * }) */ invite(request: Whop.InviteMembershipsRequestBody, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __invite; /** * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. * * @param {Whop.RetrieveMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.retrieve({ * id: "id" * }) */ retrieve(request: Whop.RetrieveMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __retrieve; /** * Updates a membership's metadata, scheduled cancellation, renewal payment method, or renewal cadence. * * @param {Whop.UpdateMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.update({ * id: "id", * billing_period_days: 45 * }) */ update(request: Whop.UpdateMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __update; /** * Applies a promo code to an `active` or `trialing` membership that does not already have one and has exactly one recurring item, for Stripe-billed memberships and memberships billed by Whop's billing engine. The discount lands on the next invoice and follows the code's duration (`once`, `repeating`, or `forever`). * * @param {Whop.ApplyPromoCodeMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.applyPromoCode({ * id: "id", * promo_code: "SAVE20" * }) */ applyPromoCode(request: Whop.ApplyPromoCodeMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __applyPromoCode; /** * Assigns an affiliate to a membership and pays them the commission you set on its future payments; past payments are not recalculated. A user who is not yet an affiliate of your account becomes one, which also requires `affiliate:create`. Send a new `commission_type` or `commission_value` for the membership's current affiliate to change their commission; a membership that already has a different affiliate returns a conflict. Works for active or trialing memberships with one recurring variant that bill through Stripe or Whop's billing engine, and not for marketplace memberships, paused payments, or a scheduled cancellation. You cannot assign yourself. * * @param {Whop.AssignAffiliateMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link Whop.ServiceUnavailableError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.assignAffiliate({ * id: "id", * commission_type: "flat_fee", * commission_value: 5, * email: "affiliate@example.com" * }) * * @example * await client.memberships.assignAffiliate({ * id: "id", * commission_type: "percentage", * commission_value: 20, * user_id: "user_xxxxxxxxxxxxx" * }) */ assignAffiliate(request: Whop.AssignAffiliateMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __assignAffiliate; /** * Cancels a membership, either immediately or at the end of the current billing period. Buyers cannot cancel buy-now-pay-later (`splitit`, `sezzle`) or non-trial split-pay memberships. * * @param {Whop.CancelMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.cancel({ * id: "id" * }) */ cancel(request: Whop.CancelMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __cancel; /** * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. * * @param {Whop.ExtendMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.extend({ * id: "id", * days: 7 * }) */ extend(request: Whop.ExtendMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __extend; /** * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. * * @param {Whop.PauseMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.pause({ * id: "id" * }) */ pause(request: Whop.PauseMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __pause; /** * Restores access to a `canceled` or `expired` membership that contains only one-time purchases and sets its `status` to `completed`. Lifetime memberships regain lifetime access; for memberships with an expiration, `days` sets the new `current_period_end`. Active and recurring memberships cannot be reactivated. * * @param {Whop.ReactivateMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.reactivate({ * id: "id" * }) */ reactivate(request: Whop.ReactivateMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __reactivate; /** * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. * * @param {Whop.ResumeMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.resume({ * id: "id" * }) */ resume(request: Whop.ResumeMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __resume; /** * Re-runs access fulfillment for a membership: recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and is not resynced. The work runs in the background and the outcome is written to the membership's logs. * * @param {Whop.ResyncAccessMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.resyncAccess({ * id: "id" * }) */ resyncAccess(request: Whop.ResyncAccessMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __resyncAccess; /** * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with `membership:transfer` when the product allows transfers and the membership is `trialing`, `active`, or `completed`. An account credential with `membership:update` bypasses both restrictions. * * @param {Whop.TransferMembershipsRequest} request * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.memberships.transfer({ * id: "id" * }) */ transfer(request: Whop.TransferMembershipsRequest, requestOptions?: MembershipsClient.RequestOptions): core.HttpResponsePromise; private __transfer; }