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"; import { DirectClient } from "../resources/direct/client/Client.js"; export declare namespace PaymentsClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } /** * A Payment is one charge against a buyer, for one or more variants. Create an on-session payment with a `confirmation_token` for the method the buyer selected, or an off-session payment with an existing member's stored payment method. * * Use the Payments API to charge buyers, list and retrieve payments, and refund, void, capture, or retry them. Collection runs in the background, so the create response is not the outcome. Poll [Retrieve status](/api-reference/beta/payments/retrieve-payment-status) for how far the payment has gone and, while it is `requires_action`, what the buyer must do next: follow a redirect, complete 3D Secure, display transfer instructions, or link a bank account. Update the payment's `return_url` to change where they land afterwards, up until they come back. */ export declare class PaymentsClient { protected readonly _options: NormalizedClientOptionsWithAuth; protected _direct: DirectClient | undefined; constructor(options?: PaymentsClient.Options); get direct(): DirectClient; /** * Lists payments, newest first. By default, returns sales for the accounts your credential can read: an account credential's own account, or every account a user can read payments for. Set `mode` to `user_sales` to list the sales the signed-in user received personally, outside any account. * * @param {Whop.ListPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.list({ * currencies: ["eur"], * variant_ids: ["plan_xxxxxxxxxxxxx"], * product_ids: ["prod_xxxxxxxxxxxxx"] * }) */ list(request?: Whop.ListPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): Promise>; /** * Charges a buyer for one or more variants with a payment method already on file (`member_id` and `payment_method_id`), or with a `confirmation_token` for a method the buyer just supplied. Collection runs in the background, so the response is the payment as created, not its outcome: poll Retrieve payment status for how far it has got and what the buyer must still do. * * @param {Whop.CreatePaymentsRequest} request * @param {PaymentsClient.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.payments.create({ * account_id: "biz_xxxxxxxxxxxxxx" * }) */ create(request: Whop.CreatePaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __create; /** * Totals up the same payments the list returns, so you can build status tabs and filter options without paging through them. Takes the same filters as List Payments. * * @param {Whop.SummaryPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.summary({ * currencies: ["usd"], * variant_ids: ["plan_xxxxxxxxxxxxx"], * product_ids: ["prod_xxxxxxxxxxxxx"] * }) */ summary(request?: Whop.SummaryPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __summary; /** * Returns one payment, including every purchased line item with its quantity and subtotal. Related records are ids — resolve a variant, membership, member or shipment on its own endpoint, and list this payment's refunds, disputes or Resolution Center cases with `?payment_id=`. * * @param {Whop.RetrievePaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.retrieve({ * id: "id" * }) */ retrieve(request: Whop.RetrievePaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __retrieve; /** * Updates a payment's `shipping_address` or `return_url`. * * @param {Whop.UpdatePaymentsRequest} request * @param {PaymentsClient.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.payments.update({ * id: "id" * }) */ update(request: Whop.UpdatePaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __update; /** * Captures the full amount of a card payment created with `capture: false`. The payment must still be in `requires_capture` before `capture_expires_at`. Partial capture, multiple captures, capturing more than the authorized amount, and tips are not supported. * * @param {Whop.CapturePaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @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.payments.capture({ * id: "id" * }) */ capture(request: Whop.CapturePaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __capture; /** * Returns the fee breakdown of one payment — Whop's fee, processing, affiliate and other lines — each in the currency it was collected in and converted to the payment's settlement currency. The list is complete in one page. * * @param {Whop.ListFeesPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.listFees({ * id: "id" * }) */ listFees(request: Whop.ListFeesPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __listFees; /** * Generates the payment's receipt (invoice) as a PDF and returns a short-lived link to download it. Each call generates a new file and link, so this endpoint does not replay `Idempotency-Key` responses. * * @param {Whop.GeneratePdfPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @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.payments.generatePdf({ * id: "id" * }) */ generatePdf(request: Whop.GeneratePdfPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __generatePdf; /** * Refunds all or part of a payment through the processor that charged it, and updates its membership to match. The buyer is emailed, the affiliate commission on the payment is clawed back, and any open Resolution Center case on the payment is closed. * * @param {Whop.RefundPaymentsRequest} request * @param {PaymentsClient.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.payments.refund({ * id: "id" * }) */ refund(request: Whop.RefundPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __refund; /** * Charges an unpaid payment again with its original payment method and variant. A payment can typically be retried once, and only while its membership is active, trialing or past due, or when it is a membership's failed first payment. * * @param {Whop.RetryPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.retry({ * id: "id" * }) */ retry(request: Whop.RetryPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __retry; /** * Voids or cancels an eligible payment. The request is rejected if the payment is no longer eligible. Some processors confirm the release of a card authorization asynchronously: the payment is then returned still `authorized`, and a `payment.canceled` webhook follows once the hold is released. * * @param {Whop.VoidPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.NotFoundError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.void({ * id: "id" * }) */ void(request: Whop.VoidPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __void; /** * Charges the saved card again, with the buyer present, for a payment their bank declined until they authenticate (such as with 3DS). Retrieve the payment afterward to get the bank's challenge from `next_action`; once the buyer completes it, they land on `return_url`, or on Whop's hosted verification page if none was given. Only the buyer can call this, with the payment's `client_secret` in the body, an OAuth token for their own account with the `member:payment_methods:use` scope, or the token from a verified `payment` session intent. An API key gets a `403`. Has no effect on a payment that is not waiting on authentication. * * @param {Whop.ResumePaymentsRequest} request * @param {PaymentsClient.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.payments.resume({ * payment_id: "payment_id" * }) */ resume(request: Whop.ResumePaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __resume; /** * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own `client_secret` in the body, so the surface that knows the final destination can set it. * * @param {Whop.UpdateReturnUrlPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.UnauthorizedError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.updateReturnUrl({ * payment_id: "payment_id", * return_url: "https://shinetime.example/checkout/thanks" * }) */ updateReturnUrl(request: Whop.UpdateReturnUrlPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __updateReturnUrl; /** * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own `client_secret` as a query parameter, so the surface collecting the payment can poll it directly. * * @param {Whop.RetrieveStatusPaymentsRequest} request * @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.UnauthorizedError} * @throws {@link Whop.ForbiddenError} * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.payments.retrieveStatus({ * payment_id: "payment_id" * }) */ retrieveStatus(request: Whop.RetrieveStatusPaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise; private __retrieveStatus; }