Skip to main content
POST
/
invoices
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  appID: 'app_xxxxxxxxxxxxxx',
  apiKey: 'My API Key',
});

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

console.log(invoice.checkout_job_id);
{
  "invoice": {
    "id": "inv_xxxxxxxxxxxxxx",
    "created_at": 1701406800,
    "status": "open",
    "number": "<string>",
    "due_date": 1701406800,
    "email_address": "<string>",
    "fetch_invoice_token": "<string>",
    "current_plan": {
      "id": "plan_xxxxxxxxxxxxx",
      "formatted_price": "<string>",
      "currency": "usd"
    },
    "user": {
      "id": "user_xxxxxxxxxxxxx",
      "name": "<string>",
      "username": "<string>"
    }
  },
  "checkout_job_id": "<string>"
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json

Parameters for CreateInvoice

company_id
string
required

The company ID to create this invoice for.

Example:

"biz_xxxxxxxxxxxxxx"

plan
object
required

The properties of the plan to create for this invoice.

collection_method
enum<string>
required

The method of collection for this invoice. If using charge_automatically, you must provide a payment_token.

Available options:
send_invoice,
charge_automatically
due_date
integer
required

The date the invoice is due, if applicable.

Example:

1701406800

product
object | null

The properties of the product to create for this invoice. Include this if you want to create an invoice for a new product.

product_id
string | null

The product ID to create this invoice for. Include this if you want to create an invoice for an existing product.

Example:

"prod_xxxxxxxxxxxxx"

customer_name
string | null

The name of the customer to create this invoice for. This is required if you want to create an invoice for a customer who does not have a member of your company yet.

email_address
string | null

The email address to create this invoice for. This is required if you want to create an invoice for a user who does not have a member of your company yet.

member_id
string | null

The member ID to create this invoice for. Include this if you want to create an invoice for an existing member. If you do not have a member ID, you must provide an email_address and customer_name.

Example:

"mber_xxxxxxxxxxxxx"

charge_buyer_fee
boolean | null

Whether or not to charge the customer a buyer fee.

payment_token_id
string | null

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

Example:

"payt_xxxxxxxxxxxxx"

Response

A successful response

Autogenerated return type of CreateInvoice.

invoice
object
required

The invoice that was created for this invoice.

checkout_job_id
string | null
required

The ID of the checkout job that was created for this invoice.

I