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.retrieve('inv_xxxxxxxxxxxxxx');
console.log(invoice.id);{
"id": "inv_xxxxxxxxxxxxxx",
"created_at": "2023-12-01T05:00:00.401Z",
"status": "draft",
"number": "#0001",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "customer@example.com",
"fetch_invoice_token": "eyJhbGciOiJIUzI1NiJ9...",
"current_plan": {
"id": "plan_xxxxxxxxxxxxx",
"formatted_price": "$10.00",
"currency": "usd"
},
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}Retrieves the details of an existing invoice.
Required permissions:
invoice:basic:readimport 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.retrieve('inv_xxxxxxxxxxxxxx');
console.log(invoice.id);{
"id": "inv_xxxxxxxxxxxxxx",
"created_at": "2023-12-01T05:00:00.401Z",
"status": "draft",
"number": "#0001",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "customer@example.com",
"fetch_invoice_token": "eyJhbGciOiJIUzI1NiJ9...",
"current_plan": {
"id": "plan_xxxxxxxxxxxxx",
"formatted_price": "$10.00",
"currency": "usd"
},
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************
The unique identifier of the invoice, or a secure token.
"inv_xxxxxxxxxxxxxx"
A successful response
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.
The unique identifier for the invoice.
"inv_xxxxxxxxxxxxxx"
The datetime the invoice was created.
"2023-12-01T05:00:00.401Z"
The current payment status of the invoice, such as draft, open, paid, or void.
draft, open, paid, past_due, void The sequential invoice number for display purposes.
"#0001"
The deadline by which payment is expected. Null if the invoice is collected automatically.
"2023-12-01T05:00:00.401Z"
The email address of the customer this invoice is addressed to. Null if no email is on file.
"customer@example.com"
A signed token that allows fetching invoice data publicly without authentication.
"eyJhbGciOiJIUzI1NiJ9..."
The plan that this invoice charges for.
Show child attributes
The user this invoice is addressed to. Null if the user account has been removed.
Show child attributes
Was this page helpful?