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: '2023-12-01T05:00:00.401Z',
  member_id: 'mber_xxxxxxxxxxxxx',
  plan: {},
  product: { title: 'title' },
});

console.log(invoice.id);
{
  "id": "inv_xxxxxxxxxxxxxx",
  "created_at": "2023-12-01T05:00:00.401Z",
  "status": "open",
  "number": "<string>",
  "due_date": "2023-12-01T05:00:00.401Z",
  "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>"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
  • CreateInvoiceInputWithProductAndMemberId
  • CreateInvoiceInputWithProductAndEmailAddress
  • CreateInvoiceInputWithProductIdAndMemberId
  • CreateInvoiceInputWithProductIdAndEmailAddress

Parameters for CreateInvoice Autogenerated input type of CreateInvoice

company_id
string
required

The company ID to create this invoice for.

Example:

"biz_xxxxxxxxxxxxxx"

product
object
required

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

member_id
string
required

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"

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
string<date-time>
required

The date the invoice is due, if applicable.

Example:

"2023-12-01T05:00:00.401Z"

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.

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

A statement that defines an amount due by a customer.

id
string
required

The ID of the invoice.

Example:

"inv_xxxxxxxxxxxxxx"

created_at
string<date-time>
required

The date the invoice was created.

Example:

"2023-12-01T05:00:00.401Z"

status
enum<string>
required

The status of the invoice.

Available options:
open,
paid,
past_due,
void
number
string
required

The number of the invoice.

due_date
string<date-time> | null
required

The date the invoice is due.

Example:

"2023-12-01T05:00:00.401Z"

email_address
string | null
required

The email address that the invoice was created for.

fetch_invoice_token
string
required

A signed token that allows fetching the invoice data publically without being authenticated.

current_plan
object
required

The plan that the invoice was created for.

user
object | null
required

The user that the invoice was created for.