> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create invoice

> Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment.

Required permissions:
 - `invoice:create`
 - `member:email:read`
 - `member:basic:read`
 - `payment:basic:read`



## OpenAPI

````yaml /openapi/api-v1-stable.json post /invoices
openapi: 3.1.0
info:
  description: >-
    The Whop REST API. Please see
    https://docs.whop.com/developer/api/getting-started for more details.
  termsOfService: https://whop.com/tos-developer-api/
  title: Whop API
  version: 1.0.0
  x-api-version-date: '2026-08-21'
servers:
  - description: Production Whop API
    url: https://api.whop.com/api/v1
  - description: Sandbox Whop API
    url: https://sandbox-api.whop.com/api/v1
security: []
tags:
  - description: Products
    name: Products
  - description: Payments
    name: Payments
  - description: Refunds
    name: Refunds
  - description: Disputes
    name: Disputes
  - description: Dispute alerts
    name: Dispute alerts
  - description: Resolution center cases
    name: Resolution center cases
  - description: Checkout configurations
    name: Checkout configurations
  - description: Setup intents
    name: Setup intents
  - description: Payment methods
    name: Payment methods
  - description: Invoices
    name: Invoices
  - description: Promo codes
    name: Promo codes
  - description: Card transactions
    name: Card transactions
  - description: Ledger accounts
    name: Ledger accounts
  - description: Withdrawals
    name: Withdrawals
  - description: Payout methods
    name: Payout methods
  - description: Verifications
    name: Verifications
  - description: Identity profiles
    name: Identity profiles
  - description: Payout accounts
    name: Payout accounts
  - description: Topups
    name: Topups
  - description: Companies
    name: Companies
  - description: Authorized users
    name: Authorized users
  - description: Fee markups
    name: Fee markups
  - description: Members
    name: Members
  - description: Memberships
    name: Memberships
  - description: Leads
    name: Leads
  - description: Entries
    name: Entries
  - description: Shipments
    name: Shipments
  - description: Reviews
    name: Reviews
  - description: Company token transactions
    name: Company token transactions
  - description: Affiliates
    name: Affiliates
  - description: Experiences
    name: Experiences
  - description: Forums
    name: Forums
  - description: Forum posts
    name: Forum posts
  - description: Chat channels
    name: Chat channels
  - description: Support channels
    name: Support channels
  - description: Messages
    name: Messages
  - description: Reactions
    name: Reactions
  - description: Dm members
    name: Dm members
  - description: Dm channels
    name: Dm channels
  - description: Notifications
    name: Notifications
  - description: Courses
    name: Courses
  - description: Course chapters
    name: Course chapters
  - description: Course lessons
    name: Course lessons
  - description: Course students
    name: Course students
  - description: Course lesson interactions
    name: Course lesson interactions
  - description: Apps
    name: Apps
  - description: Webhooks
    name: Webhooks
  - description: App builds
    name: App builds
  - description: Access tokens
    name: Access tokens
  - description: Account links
    name: Account links
  - description: Files
    name: Files
  - description: Ai chats
    name: Ai chats
  - description: Bounties
    name: Bounties
  - description: Stats
    name: Stats
  - description: Conversions
    name: Conversions
  - description: Ad reports
    name: Ad reports
paths:
  /invoices:
    post:
      tags:
        - Invoices
      summary: Create invoice
      description: >-
        Create an invoice for a customer. The invoice can be charged
        automatically using a stored payment method, or sent to the customer for
        manual payment.


        Required permissions:
         - `invoice:create`
         - `member:email:read`
         - `member:basic:read`
         - `payment:basic:read`
      operationId: createInvoice
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              description: Parameters for CreateInvoice
              oneOf:
                - description: Autogenerated input type of CreateInvoice
                  properties:
                    automatically_finalizes_at:
                      description: >-
                        The date and time when the invoice will be automatically
                        finalized. For charge_automatically, triggers an
                        automatic charge. For send_invoice, sends the invoice
                        email to the customer at the specified time.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                    billing_address:
                      description: >-
                        Inline billing address to create a new mailing address
                        for this invoice. Cannot be used together with
                        mailing_address_id.
                      properties:
                        city:
                          description: The city of the address.
                          type:
                            - string
                            - 'null'
                        country:
                          description: The country of the address.
                          type:
                            - string
                            - 'null'
                        line1:
                          description: The line 1 of the address.
                          type:
                            - string
                            - 'null'
                        line2:
                          description: The line 2 of the address.
                          type:
                            - string
                            - 'null'
                        name:
                          description: The name of the customer.
                          type:
                            - string
                            - 'null'
                        phone:
                          description: The phone number of the customer.
                          type:
                            - string
                            - 'null'
                        postal_code:
                          description: The postal code of the address.
                          type:
                            - string
                            - 'null'
                        state:
                          description: The state of the address.
                          type:
                            - string
                            - 'null'
                        tax_id_type:
                          description: The type of tax identifier.
                          oneOf:
                            - $ref: '#/components/schemas/TaxIdentifierTypes'
                            - type: 'null'
                        tax_id_value:
                          description: The value of the tax identifier.
                          type:
                            - string
                            - 'null'
                      required: []
                      type:
                        - object
                        - 'null'
                    charge_buyer_fee:
                      description: >-
                        Whether to charge the customer a buyer fee on this
                        invoice.
                      type:
                        - boolean
                        - 'null'
                    collection_method:
                      $ref: '#/components/schemas/InvoiceCollectionMethods'
                      description: >-
                        How the invoice should be collected. Use
                        charge_automatically to charge a stored payment method,
                        or send_invoice to email the customer.
                    company_id:
                      description: >-
                        The unique identifier of the company to create this
                        invoice for.
                      example: biz_xxxxxxxxxxxxxx
                      type: string
                    customer_name:
                      description: >-
                        The name of the customer. Required when creating an
                        invoice for a customer who is not yet a member of the
                        company.
                      type:
                        - string
                        - 'null'
                    due_date:
                      description: >-
                        The date by which the invoice must be paid. Required
                        unless save_as_draft is true.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                    email_address:
                      description: >-
                        The email address of the customer. Required when
                        creating an invoice for a customer who is not yet a
                        member of the company.
                      type:
                        - string
                        - 'null'
                    line_items:
                      description: >-
                        Optional line items that break down the invoice total.
                        When provided, the sum of (quantity * unit_price) for
                        all items must equal the plan price.
                      items:
                        description: >-
                          A single line item to include on the invoice, with a
                          label, quantity, and unit price.
                        properties:
                          label:
                            description: The label or description for this line item.
                            type: string
                          quantity:
                            description: The quantity of this line item. Defaults to 1.
                            example: 6.9
                            type:
                              - number
                              - 'null'
                          unit_price:
                            description: >-
                              The unit price for this line item. Provided as a
                              number in the specified currency. Eg: 10.43 for
                              $10.43
                            example: 6.9
                            type: number
                        required:
                          - label
                          - unit_price
                        type: object
                      type:
                        - array
                        - 'null'
                    mailing_address_id:
                      description: >-
                        The unique identifier of an existing mailing address to
                        attach to this invoice. Cannot be used together with
                        billing_address.
                      example: ma_xxxxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    member_id:
                      description: >-
                        The unique identifier of an existing member to create
                        this invoice for. If not provided, you must supply an
                        email_address and customer_name.
                      example: mber_xxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    payment_method_id:
                      description: >-
                        The unique identifier of the payment method to charge.
                        Required when collection_method is charge_automatically.
                      example: pmt_xxxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    payment_token_id:
                      description: >-
                        The payment token ID to use for this invoice. If using
                        charge_automatically, you must provide a payment_token.
                      example: payt_xxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    plan:
                      description: >-
                        The plan attributes defining the price, currency, and
                        billing interval for this invoice.
                      properties:
                        adaptive_pricing_enabled:
                          description: >-
                            Whether this plan accepts local currency payments
                            via adaptive pricing.
                          type:
                            - boolean
                            - 'null'
                        billing_period:
                          description: >-
                            The interval in days at which the plan charges
                            (renewal plans).
                          example: 42
                          type:
                            - integer
                            - 'null'
                        currency:
                          description: >-
                            The three-letter ISO currency code for the plan's
                            pricing. Defaults to USD.
                          oneOf:
                            - $ref: '#/components/schemas/Currencies'
                            - type: 'null'
                        custom_fields:
                          description: An array of custom field objects.
                          items:
                            properties:
                              field_type:
                                $ref: '#/components/schemas/CustomFieldTypes'
                                description: The type of the custom field.
                              id:
                                description: The ID of the custom field (if being updated)
                                type:
                                  - string
                                  - 'null'
                              name:
                                description: The name of the custom field.
                                type: string
                              order:
                                description: The order of the field.
                                example: 42
                                type:
                                  - integer
                                  - 'null'
                              placeholder:
                                description: The placeholder value of the field.
                                type:
                                  - string
                                  - 'null'
                              required:
                                description: Whether or not the field is required.
                                type:
                                  - boolean
                                  - 'null'
                            required:
                              - field_type
                              - name
                            type: object
                          type:
                            - array
                            - 'null'
                        description:
                          description: The description of the plan.
                          type:
                            - string
                            - 'null'
                        expiration_days:
                          description: >-
                            The number of days until the membership expires and
                            revokes access (expiration plans). For example, 365
                            for a one-year access period.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        initial_price:
                          description: >-
                            An additional amount charged upon first purchase.
                            Use only if a one time payment OR you want to charge
                            an additional amount on top of the renewal price.
                            Provided as a number in the specified currency. Eg:
                            10.43 for $10.43
                          example: 6.9
                          type:
                            - number
                            - 'null'
                        internal_notes:
                          description: >-
                            A personal description or notes section for the
                            business.
                          type:
                            - string
                            - 'null'
                        legacy_payment_method_controls:
                          description: >-
                            Whether this plan uses legacy payment method
                            controls
                          type:
                            - boolean
                            - 'null'
                        payment_method_configuration:
                          description: >-
                            The explicit payment method configuration for the
                            plan. If not provided, the platform or company's
                            defaults will apply.
                          properties:
                            disabled:
                              description: >-
                                An array of payment method identifiers that are
                                explicitly disabled. Only applies if the
                                include_platform_defaults is true.
                              items:
                                $ref: '#/components/schemas/PaymentMethodTypes'
                              type: array
                            enabled:
                              description: >-
                                An array of payment method identifiers that are
                                explicitly enabled. This means these payment
                                methods will be shown on checkout. Example use
                                case is to only enable a specific payment method
                                like cashapp, or extending the platform defaults
                                with additional methods.
                              items:
                                $ref: '#/components/schemas/PaymentMethodTypes'
                              type: array
                            include_platform_defaults:
                              description: >-
                                Whether Whop's platform default payment method
                                enablement settings are included in this
                                configuration. The full list of default payment
                                methods can be found in the documentation at
                                docs.whop.com/payments.
                              type:
                                - boolean
                                - 'null'
                          required:
                            - disabled
                            - enabled
                          type:
                            - object
                            - 'null'
                        plan_type:
                          description: >-
                            Indicates if the plan is a one time payment or
                            recurring.
                          oneOf:
                            - $ref: '#/components/schemas/PlanTypes'
                            - type: 'null'
                        release_method:
                          description: >-
                            This is the release method the business uses to sell
                            this plan.
                          oneOf:
                            - $ref: '#/components/schemas/ReleaseMethod'
                            - type: 'null'
                        renewal_price:
                          description: >-
                            The amount the customer is charged every billing
                            period. Use only if a recurring payment. Provided as
                            a number in the specified currency. Eg: 10.43 for
                            $10.43
                          example: 6.9
                          type:
                            - number
                            - 'null'
                        stock:
                          description: The number of units available for purchase.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        trial_period_days:
                          description: >-
                            The number of free trial days added before a renewal
                            plan.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        unlimited_stock:
                          description: >-
                            When true, the plan has unlimited stock (stock field
                            is ignored). When false, purchases are limited by
                            the stock field.
                          type:
                            - boolean
                            - 'null'
                        visibility:
                          description: Shows or hides the plan from public/business view.
                          oneOf:
                            - $ref: '#/components/schemas/Visibility'
                            - type: 'null'
                      required: []
                      type: object
                    product:
                      description: >-
                        The properties of the product to create for this
                        invoice. Provide this to create a new product inline.
                      properties:
                        product_tax_code_id:
                          description: >-
                            The ID of the product tax code to apply to this
                            product.
                          example: ptc_xxxxxxxxxxxxxx
                          type:
                            - string
                            - 'null'
                        title:
                          description: The title of the product.
                          type: string
                      required:
                        - title
                      type: object
                    save_as_draft:
                      description: >-
                        When true, creates the invoice as a draft without
                        sending or charging. Relaxes customer and due date
                        requirements.
                      type:
                        - boolean
                        - 'null'
                    subscription_billing_anchor_at:
                      description: >-
                        The date that defines when the subscription billing
                        cycle should start. When set on a renewal plan invoice,
                        this anchors all future billing periods to this date.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                  required:
                    - company_id
                    - plan
                    - collection_method
                    - product
                  title: CreateInvoiceInputWithProduct
                  type: object
                - description: Autogenerated input type of CreateInvoice
                  properties:
                    automatically_finalizes_at:
                      description: >-
                        The date and time when the invoice will be automatically
                        finalized. For charge_automatically, triggers an
                        automatic charge. For send_invoice, sends the invoice
                        email to the customer at the specified time.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                    billing_address:
                      description: >-
                        Inline billing address to create a new mailing address
                        for this invoice. Cannot be used together with
                        mailing_address_id.
                      properties:
                        city:
                          description: The city of the address.
                          type:
                            - string
                            - 'null'
                        country:
                          description: The country of the address.
                          type:
                            - string
                            - 'null'
                        line1:
                          description: The line 1 of the address.
                          type:
                            - string
                            - 'null'
                        line2:
                          description: The line 2 of the address.
                          type:
                            - string
                            - 'null'
                        name:
                          description: The name of the customer.
                          type:
                            - string
                            - 'null'
                        phone:
                          description: The phone number of the customer.
                          type:
                            - string
                            - 'null'
                        postal_code:
                          description: The postal code of the address.
                          type:
                            - string
                            - 'null'
                        state:
                          description: The state of the address.
                          type:
                            - string
                            - 'null'
                        tax_id_type:
                          description: The type of tax identifier.
                          oneOf:
                            - $ref: '#/components/schemas/TaxIdentifierTypes'
                            - type: 'null'
                        tax_id_value:
                          description: The value of the tax identifier.
                          type:
                            - string
                            - 'null'
                      required: []
                      type:
                        - object
                        - 'null'
                    charge_buyer_fee:
                      description: >-
                        Whether to charge the customer a buyer fee on this
                        invoice.
                      type:
                        - boolean
                        - 'null'
                    collection_method:
                      $ref: '#/components/schemas/InvoiceCollectionMethods'
                      description: >-
                        How the invoice should be collected. Use
                        charge_automatically to charge a stored payment method,
                        or send_invoice to email the customer.
                    company_id:
                      description: >-
                        The unique identifier of the company to create this
                        invoice for.
                      example: biz_xxxxxxxxxxxxxx
                      type: string
                    customer_name:
                      description: >-
                        The name of the customer. Required when creating an
                        invoice for a customer who is not yet a member of the
                        company.
                      type:
                        - string
                        - 'null'
                    due_date:
                      description: >-
                        The date by which the invoice must be paid. Required
                        unless save_as_draft is true.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                    email_address:
                      description: >-
                        The email address of the customer. Required when
                        creating an invoice for a customer who is not yet a
                        member of the company.
                      type:
                        - string
                        - 'null'
                    line_items:
                      description: >-
                        Optional line items that break down the invoice total.
                        When provided, the sum of (quantity * unit_price) for
                        all items must equal the plan price.
                      items:
                        description: >-
                          A single line item to include on the invoice, with a
                          label, quantity, and unit price.
                        properties:
                          label:
                            description: The label or description for this line item.
                            type: string
                          quantity:
                            description: The quantity of this line item. Defaults to 1.
                            example: 6.9
                            type:
                              - number
                              - 'null'
                          unit_price:
                            description: >-
                              The unit price for this line item. Provided as a
                              number in the specified currency. Eg: 10.43 for
                              $10.43
                            example: 6.9
                            type: number
                        required:
                          - label
                          - unit_price
                        type: object
                      type:
                        - array
                        - 'null'
                    mailing_address_id:
                      description: >-
                        The unique identifier of an existing mailing address to
                        attach to this invoice. Cannot be used together with
                        billing_address.
                      example: ma_xxxxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    member_id:
                      description: >-
                        The unique identifier of an existing member to create
                        this invoice for. If not provided, you must supply an
                        email_address and customer_name.
                      example: mber_xxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    payment_method_id:
                      description: >-
                        The unique identifier of the payment method to charge.
                        Required when collection_method is charge_automatically.
                      example: pmt_xxxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    payment_token_id:
                      description: >-
                        The payment token ID to use for this invoice. If using
                        charge_automatically, you must provide a payment_token.
                      example: payt_xxxxxxxxxxxxx
                      type:
                        - string
                        - 'null'
                    plan:
                      description: >-
                        The plan attributes defining the price, currency, and
                        billing interval for this invoice.
                      properties:
                        adaptive_pricing_enabled:
                          description: >-
                            Whether this plan accepts local currency payments
                            via adaptive pricing.
                          type:
                            - boolean
                            - 'null'
                        billing_period:
                          description: >-
                            The interval in days at which the plan charges
                            (renewal plans).
                          example: 42
                          type:
                            - integer
                            - 'null'
                        currency:
                          description: >-
                            The three-letter ISO currency code for the plan's
                            pricing. Defaults to USD.
                          oneOf:
                            - $ref: '#/components/schemas/Currencies'
                            - type: 'null'
                        custom_fields:
                          description: An array of custom field objects.
                          items:
                            properties:
                              field_type:
                                $ref: '#/components/schemas/CustomFieldTypes'
                                description: The type of the custom field.
                              id:
                                description: The ID of the custom field (if being updated)
                                type:
                                  - string
                                  - 'null'
                              name:
                                description: The name of the custom field.
                                type: string
                              order:
                                description: The order of the field.
                                example: 42
                                type:
                                  - integer
                                  - 'null'
                              placeholder:
                                description: The placeholder value of the field.
                                type:
                                  - string
                                  - 'null'
                              required:
                                description: Whether or not the field is required.
                                type:
                                  - boolean
                                  - 'null'
                            required:
                              - field_type
                              - name
                            type: object
                          type:
                            - array
                            - 'null'
                        description:
                          description: The description of the plan.
                          type:
                            - string
                            - 'null'
                        expiration_days:
                          description: >-
                            The number of days until the membership expires and
                            revokes access (expiration plans). For example, 365
                            for a one-year access period.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        initial_price:
                          description: >-
                            An additional amount charged upon first purchase.
                            Use only if a one time payment OR you want to charge
                            an additional amount on top of the renewal price.
                            Provided as a number in the specified currency. Eg:
                            10.43 for $10.43
                          example: 6.9
                          type:
                            - number
                            - 'null'
                        internal_notes:
                          description: >-
                            A personal description or notes section for the
                            business.
                          type:
                            - string
                            - 'null'
                        legacy_payment_method_controls:
                          description: >-
                            Whether this plan uses legacy payment method
                            controls
                          type:
                            - boolean
                            - 'null'
                        payment_method_configuration:
                          description: >-
                            The explicit payment method configuration for the
                            plan. If not provided, the platform or company's
                            defaults will apply.
                          properties:
                            disabled:
                              description: >-
                                An array of payment method identifiers that are
                                explicitly disabled. Only applies if the
                                include_platform_defaults is true.
                              items:
                                $ref: '#/components/schemas/PaymentMethodTypes'
                              type: array
                            enabled:
                              description: >-
                                An array of payment method identifiers that are
                                explicitly enabled. This means these payment
                                methods will be shown on checkout. Example use
                                case is to only enable a specific payment method
                                like cashapp, or extending the platform defaults
                                with additional methods.
                              items:
                                $ref: '#/components/schemas/PaymentMethodTypes'
                              type: array
                            include_platform_defaults:
                              description: >-
                                Whether Whop's platform default payment method
                                enablement settings are included in this
                                configuration. The full list of default payment
                                methods can be found in the documentation at
                                docs.whop.com/payments.
                              type:
                                - boolean
                                - 'null'
                          required:
                            - disabled
                            - enabled
                          type:
                            - object
                            - 'null'
                        plan_type:
                          description: >-
                            Indicates if the plan is a one time payment or
                            recurring.
                          oneOf:
                            - $ref: '#/components/schemas/PlanTypes'
                            - type: 'null'
                        release_method:
                          description: >-
                            This is the release method the business uses to sell
                            this plan.
                          oneOf:
                            - $ref: '#/components/schemas/ReleaseMethod'
                            - type: 'null'
                        renewal_price:
                          description: >-
                            The amount the customer is charged every billing
                            period. Use only if a recurring payment. Provided as
                            a number in the specified currency. Eg: 10.43 for
                            $10.43
                          example: 6.9
                          type:
                            - number
                            - 'null'
                        stock:
                          description: The number of units available for purchase.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        trial_period_days:
                          description: >-
                            The number of free trial days added before a renewal
                            plan.
                          example: 42
                          type:
                            - integer
                            - 'null'
                        unlimited_stock:
                          description: >-
                            When true, the plan has unlimited stock (stock field
                            is ignored). When false, purchases are limited by
                            the stock field.
                          type:
                            - boolean
                            - 'null'
                        visibility:
                          description: Shows or hides the plan from public/business view.
                          oneOf:
                            - $ref: '#/components/schemas/Visibility'
                            - type: 'null'
                      required: []
                      type: object
                    product_id:
                      description: >-
                        The unique identifier of an existing product to create
                        this invoice for.
                      example: prod_xxxxxxxxxxxxx
                      type: string
                    save_as_draft:
                      description: >-
                        When true, creates the invoice as a draft without
                        sending or charging. Relaxes customer and due date
                        requirements.
                      type:
                        - boolean
                        - 'null'
                    subscription_billing_anchor_at:
                      description: >-
                        The date that defines when the subscription billing
                        cycle should start. When set on a renewal plan invoice,
                        this anchors all future billing periods to this date.
                      example: '2023-12-01T05:00:00.401Z'
                      format: date-time
                      type:
                        - string
                        - 'null'
                  required:
                    - company_id
                    - plan
                    - collection_method
                    - product_id
                  title: CreateInvoiceInputWithProductId
                  type: object
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
          description: A successful response
        '400':
          content:
            application/json:
              example:
                error:
                  code: parameter_missing
                  message: 'Missing required parameter: amount.'
                  param: amount
                  type: invalid_request_error
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Bad request
        '401':
          content:
            application/json:
              example:
                error:
                  message: Invalid or missing API key
                  type: unauthorized
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                error:
                  message: You do not have permission to access this resource
                  type: forbidden
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Forbidden
        '404':
          content:
            application/json:
              example:
                error:
                  message: Resource not found
                  type: not_found
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Not found
        '422':
          content:
            application/json:
              example:
                error: null
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Verification required
        '429':
          content:
            application/json:
              example:
                error: null
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Too many requests
        '500':
          content:
            application/json:
              example:
                error:
                  message: An unexpected error occurred
                  type: internal_server_error
              schema:
                properties:
                  error:
                    properties:
                      code:
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                        type:
                          - string
                          - 'null'
                      message:
                        type: string
                      param:
                        description: The parameter that caused the error, if applicable
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                    required:
                      - type
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Internal server error
      security:
        - bearerAuth:
            - invoice:create
            - member:email:read
            - member:basic:read
            - payment:basic:read
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Whop from '@whop/sdk';

            const client = new Whop({
              apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
            });

            const invoice = await client.invoices.create({
              collection_method: 'send_invoice',
              company_id: 'biz_xxxxxxxxxxxxxx',
              plan: {},
              product: { title: 'title' },
            });

            console.log(invoice.id);
components:
  schemas:
    TaxIdentifierTypes:
      description: The type of tax identifier
      enum:
        - ad_nrt
        - ao_tin
        - ar_cuit
        - al_tin
        - am_tin
        - aw_tin
        - au_abn
        - au_arn
        - eu_vat
        - az_tin
        - bs_tin
        - bh_vat
        - bd_bin
        - bb_tin
        - by_tin
        - bj_ifu
        - bo_tin
        - ba_tin
        - br_cnpj
        - br_cpf
        - bg_uic
        - bf_ifu
        - kh_tin
        - cm_niu
        - ca_bn
        - ca_gst_hst
        - ca_pst_bc
        - ca_pst_mb
        - ca_pst_sk
        - ca_qst
        - cv_nif
        - cl_tin
        - cn_tin
        - co_nit
        - cd_nif
        - cr_tin
        - hr_oib
        - do_rcn
        - ec_ruc
        - eg_tin
        - sv_nit
        - et_tin
        - eu_oss_vat
        - ge_vat
        - gh_tin
        - de_stn
        - gb_vat
        - gn_nif
        - hk_br
        - hu_tin
        - is_vat
        - in_gst
        - id_npwp
        - il_vat
        - jp_cn
        - jp_rn
        - jp_trn
        - kz_bin
        - ke_pin
        - kg_tin
        - la_tin
        - li_uid
        - li_vat
        - my_frp
        - my_itn
        - my_sst
        - mr_nif
        - mx_rfc
        - md_vat
        - me_pib
        - ma_vat
        - np_pan
        - nz_gst
        - ng_tin
        - mk_vat
        - no_vat
        - no_voec
        - om_vat
        - pe_ruc
        - ph_tin
        - pl_nip
        - ro_tin
        - ru_inn
        - ru_kpp
        - sa_vat
        - sn_ninea
        - rs_pib
        - sg_gst
        - sg_uen
        - si_tin
        - za_vat
        - kr_brn
        - es_cif
        - ch_uid
        - ch_vat
        - tw_vat
        - tj_tin
        - tz_vat
        - th_vat
        - tr_tin
        - ug_tin
        - ua_vat
        - ae_trn
        - us_ein
        - uy_ruc
        - uz_tin
        - uz_vat
        - ve_rif
        - vn_tin
        - zm_tin
        - zw_tin
        - sr_fin
        - xi_vat
      type: string
    InvoiceCollectionMethods:
      description: The method of collection for an invoice.
      enum:
        - send_invoice
        - charge_automatically
      type: string
    Currencies:
      description: The available currencies on the platform
      enum:
        - usd
        - sgd
        - inr
        - aud
        - brl
        - cad
        - dkk
        - eur
        - nok
        - gbp
        - sek
        - chf
        - hkd
        - huf
        - jpy
        - mxn
        - myr
        - pln
        - czk
        - nzd
        - aed
        - eth
        - ape
        - cop
        - ron
        - thb
        - bgn
        - idr
        - dop
        - php
        - try
        - krw
        - twd
        - vnd
        - pkr
        - clp
        - uyu
        - ars
        - zar
        - dzd
        - tnd
        - mad
        - kes
        - kwd
        - jod
        - all
        - xcd
        - amd
        - bsd
        - bhd
        - bob
        - bam
        - khr
        - crc
        - xof
        - egp
        - etb
        - gmd
        - ghs
        - gtq
        - gyd
        - ils
        - jmd
        - mop
        - mga
        - mur
        - mdl
        - mnt
        - nad
        - ngn
        - mkd
        - omr
        - pyg
        - pen
        - qar
        - rwf
        - sar
        - rsd
        - lkr
        - tzs
        - ttd
        - uzs
        - rub
        - btc
        - cny
        - usdt
        - kzt
        - awg
        - whop_usd
        - xau
      type: string
    CustomFieldTypes:
      const: text
      description: The type of the custom field.
      type: string
    PaymentMethodTypes:
      description: The different types of payment methods that can be used.
      enum:
        - acss_debit
        - addi
        - affirm
        - afterpay_clearpay
        - alipay
        - alma
        - amazon_pay
        - apple
        - apple_pay
        - au_bank_transfer
        - au_becs_debit
        - bacs_debit
        - bancolombia
        - bancontact
        - bank_wire
        - billie
        - bizum
        - blik
        - boleto
        - bre_b
        - ca_bank_transfer
        - capchase_pay
        - card
        - card_installments_three
        - card_installments_six
        - card_installments_twelve
        - cashapp
        - claritypay
        - coinbase
        - crypto
        - custom
        - customer_balance
        - demo_pay
        - efecty
        - eps
        - eu_bank_transfer
        - fpx
        - gb_bank_transfer
        - giropay
        - google_pay
        - gopay
        - grabpay
        - id_bank_transfer
        - ideal
        - interac
        - kakao_pay
        - klarna
        - klarna_pay_now
        - konbini
        - kr_card
        - kr_market
        - kriya
        - kueski
        - link
        - mb_way
        - m_pesa
        - mercado_pago
        - mobilepay
        - modo
        - mondu
        - multibanco
        - naver_pay
        - nequi
        - netbanking
        - ng_bank
        - ng_bank_transfer
        - ng_card
        - ng_market
        - ng_ussd
        - ng_wallet
        - nz_bank_account
        - oxxo
        - p24
        - pago_efectivo
        - pse
        - pay_by_bank
        - payco
        - paynow
        - paypal
        - paypay
        - payto
        - pix
        - platform_balance
        - promptpay
        - qris
        - rapipago
        - rechnung
        - revolut_pay
        - samsung_pay
        - satispay
        - scalapay
        - sencillito
        - sepa_debit
        - sequra
        - servipag
        - sezzle
        - shop_pay
        - shopeepay
        - sofort
        - south_korea_market
        - spei
        - splitit
        - sunbit
        - swish
        - tamara
        - twint
        - upi
        - us_bank_account
        - us_bank_transfer
        - venmo
        - vipps
        - webpay
        - wechat_pay
        - yape
        - zip
        - coinflow
        - unknown
      type: string
    PlanTypes:
      description: The type of plan that can be attached to a product
      enum:
        - renewal
        - one_time
      type: string
    ReleaseMethod:
      description: The methods of how a plan can be released.
      enum:
        - buy_now
        - waitlist
      type: string
    Visibility:
      description: Visibility of a resource
      enum:
        - visible
        - hidden
        - archived
        - quick_link
      type: string
    Invoice:
      description: >-
        An invoice represents an itemized bill sent by a company to a customer
        for a specific product and plan, tracking the amount owed, due date, and
        payment status.
      properties:
        automatically_finalizes_at:
          description: >-
            The date and time when the invoice will be automatically finalized.
            For charge_automatically, triggers an automatic charge. For
            send_invoice, sends the invoice email at the specified time.
          example: '2023-12-01T05:00:00.401Z'
          format: date-time
          type:
            - string
            - 'null'
        charge_buyer_fee:
          description: >-
            Whether the invoice includes a buyer processing fee on top of the
            plan price.
          type: boolean
        collection_method:
          $ref: '#/components/schemas/InvoiceCollectionMethods'
          description: >-
            The method used to collect payment for this invoice, such as
            automatic charging or manual payment.
        company:
          description: The company that issued this invoice.
          properties:
            id:
              description: The unique identifier for the company.
              example: biz_xxxxxxxxxxxxxx
              type: string
          required:
            - id
          type: object
        created_at:
          description: The datetime the invoice was created.
          example: '2023-12-01T05:00:00.401Z'
          format: date-time
          type: string
        current_plan:
          description: The plan that this invoice charges for.
          properties:
            currency:
              $ref: '#/components/schemas/Currencies'
              description: >-
                The currency used for all prices on this plan (e.g., 'usd',
                'eur'). All monetary amounts on the plan are denominated in this
                currency.
            description:
              description: >-
                A text description of the plan visible to customers. Maximum
                1000 characters. Null if no description is set.
              example: >-
                Monthly access to all premium analytics dashboards and data
                exports.
              type:
                - string
                - 'null'
            formatted_price:
              description: The formatted price (including currency) for the plan.
              example: $10.00
              type: string
            id:
              description: The unique identifier for the plan.
              example: plan_xxxxxxxxxxxxx
              type: string
          required:
            - id
            - formatted_price
            - currency
            - description
          type: object
        customer_name:
          description: >-
            The full name of the customer this invoice is addressed to. Null if
            no name is on file.
          example: Jane Doe
          type:
            - string
            - 'null'
        due_date:
          description: >-
            The deadline by which payment is expected. Null if the invoice is
            collected automatically.
          example: '2023-12-01T05:00:00.401Z'
          format: date-time
          type:
            - string
            - 'null'
        email_address:
          description: >-
            The email address of the customer this invoice is addressed to. Null
            if no email is on file.
          example: customer@example.com
          type:
            - string
            - 'null'
        fetch_invoice_token:
          description: >-
            A signed token that allows fetching invoice data publicly without
            authentication.
          example: eyJhbGciOiJIUzI1NiJ9...
          type: string
        id:
          description: The unique identifier for the invoice.
          example: inv_xxxxxxxxxxxxxx
          type: string
        line_items:
          description: >-
            Optional line items that break down the invoice total into
            individual charges.
          items:
            description: >-
              A line item on an invoice, representing a single charge with a
              label, quantity, and unit price.
            properties:
              label:
                description: The label or description for this line item.
                example: Platform subscription
                type: string
              position:
                description: The display order of this line item within the invoice.
                example: 42
                type: integer
              quantity:
                description: The quantity of this line item.
                example: 6.9
                type: number
              total:
                description: The computed total for this line item (quantity * unit_price).
                example: 6.9
                type: number
              unit_price:
                description: The unit price for this line item.
                example: 6.9
                type: number
            required:
              - label
              - quantity
              - unit_price
              - total
              - position
            type: object
          type: array
        mailing_address:
          description: >-
            The billing/mailing address associated with this invoice, if one was
            provided at creation time.
          properties:
            city:
              description: The city of the address.
              type:
                - string
                - 'null'
            country:
              description: The country of the address.
              type:
                - string
                - 'null'
            line1:
              description: The line 1 of the address.
              type:
                - string
                - 'null'
            line2:
              description: The line 2 of the address.
              type:
                - string
                - 'null'
            name:
              description: The name of the customer.
              type:
                - string
                - 'null'
            phone:
              description: The phone number of the customer.
              type:
                - string
                - 'null'
            postal_code:
              description: The postal code of the address.
              type:
                - string
                - 'null'
            state:
              description: The state of the address.
              type:
                - string
                - 'null'
          required:
            - name
            - line1
            - line2
            - city
            - state
            - postal_code
            - country
            - phone
          type:
            - object
            - 'null'
        member:
          description: >-
            The member that the invoice was created for. Null when the invoice
            is addressed to an email address with no member record behind it.
          properties:
            id:
              description: The unique identifier for the company member.
              type: string
          required:
            - id
          type:
            - object
            - 'null'
        number:
          description: The sequential invoice number for display purposes.
          example: '#0001'
          type: string
        pay_online_url:
          description: >-
            The checkout URL where the customer can pay this invoice online,
            with their email address pre-filled and locked.
          type:
            - string
            - 'null'
        payment:
          description: >-
            The payment that settled this invoice. Null while the invoice is
            unpaid, when the invoice was marked paid manually, and on a
            subscription renewal invoice, where the settling payment cannot yet
            be identified.
          properties:
            id:
              description: The unique identifier for the payment.
              example: pay_xxxxxxxxxxxxxx
              type: string
          required:
            - id
          type:
            - object
            - 'null'
        payment_processing:
          description: >-
            Whether a payment on this invoice is still clearing. True while a
            delayed payment method such as ACH or SEPA settles, during which the
            invoice stays open and is not marked past due.
          type: boolean
        product:
          description: The product that this invoice was generated for.
          properties:
            id:
              description: The unique identifier for the product.
              example: prod_xxxxxxxxxxxxx
              type: string
            title:
              description: >-
                The display name of the product shown to customers on the
                product page and in search results.
              example: Pickaxe Analytics
              type: string
          required:
            - id
            - title
          type: object
        status:
          $ref: '#/components/schemas/InvoiceStatuses'
          description: >-
            The current payment status of the invoice, such as draft, open,
            paid, or void.
        subscription_billing_anchor_at:
          description: >-
            The date that defines when the subscription billing cycle starts.
            When set on a renewal plan invoice, all future billing periods
            anchor to this date.
          example: '2023-12-01T05:00:00.401Z'
          format: date-time
          type:
            - string
            - 'null'
        updated_at:
          description: The datetime the invoice was last updated.
          example: '2023-12-01T05:00:00.401Z'
          format: date-time
          type: string
        user:
          description: >-
            The user this invoice is addressed to. Null if the user account has
            been removed.
          properties:
            email:
              description: >-
                The user's email address. Requires the member:email:read
                permission to access. Null if not authorized.
              example: john.doe@example.com
              type:
                - string
                - 'null'
            id:
              description: The unique identifier for the user.
              example: user_xxxxxxxxxxxxx
              type: string
            name:
              description: The user's display name shown on their public profile.
              example: John Doe
              type:
                - string
                - 'null'
            username:
              description: The user's unique username shown on their public profile.
              example: johndoe42
              type: string
          required:
            - id
            - name
            - username
            - email
          type:
            - object
            - 'null'
      required:
        - id
        - created_at
        - status
        - payment_processing
        - number
        - due_date
        - email_address
        - fetch_invoice_token
        - line_items
        - updated_at
        - company
        - user
        - member
        - payment
        - automatically_finalizes_at
        - subscription_billing_anchor_at
        - collection_method
        - charge_buyer_fee
        - customer_name
        - pay_online_url
        - current_plan
        - product
        - mailing_address
      type: object
    InvoiceStatuses:
      description: The different statuses an invoice can be in
      enum:
        - draft
        - open
        - paid
        - past_due
        - uncollectible
        - void
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: auth-scheme
      description: >-
        An Account API key, account-scoped JWT, App API key, or user OAuth
        token. Prepend the key or token with `Bearer`, for example `Bearer
        ***************************`.
      scheme: bearer
      type: http

````