POST
/
invoices
JavaScript
import Whopsdk from 'whopsdk';

const client = new Whopsdk({
  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": null,
  "checkout_job_id": "<string>"
}

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> | null
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

access_pass
object | null

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

access_pass_id
string | null

The access pass 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 | null
required

The invoice that was created for this invoice. A statement that defines an amount due by a customer.

checkout_job_id
string | null
required

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