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.update('inv_xxxxxxxxxxxxxx');
console.log(invoice.id);curl --request PATCH \
--url https://api.whop.com/api/v1/invoices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"automatically_finalizes_at": "2023-12-01T05:00:00.401Z",
"billing_address": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"tax_id_value": "<string>"
},
"charge_buyer_fee": true,
"customer_name": "<string>",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "<string>",
"line_items": [
{
"label": "<string>",
"unit_price": 6.9,
"quantity": 6.9
}
],
"mailing_address_id": "ma_xxxxxxxxxxxxxxx",
"member_id": "mber_xxxxxxxxxxxxx",
"payment_method_id": "pmt_xxxxxxxxxxxxxx",
"plan": {
"adaptive_pricing_enabled": true,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": true
}
],
"description": "<string>",
"expiration_days": 42,
"initial_price": 6.9,
"internal_notes": "<string>",
"legacy_payment_method_controls": true,
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"renewal_price": 6.9,
"stock": 42,
"trial_period_days": 42,
"unlimited_stock": true
},
"product_id": "prod_xxxxxxxxxxxxx",
"subscription_billing_anchor_at": "2023-12-01T05:00:00.401Z"
}
'import requests
url = "https://api.whop.com/api/v1/invoices/{id}"
payload = {
"automatically_finalizes_at": "2023-12-01T05:00:00.401Z",
"billing_address": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"tax_id_value": "<string>"
},
"charge_buyer_fee": True,
"customer_name": "<string>",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "<string>",
"line_items": [
{
"label": "<string>",
"unit_price": 6.9,
"quantity": 6.9
}
],
"mailing_address_id": "ma_xxxxxxxxxxxxxxx",
"member_id": "mber_xxxxxxxxxxxxx",
"payment_method_id": "pmt_xxxxxxxxxxxxxx",
"plan": {
"adaptive_pricing_enabled": True,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": True
}
],
"description": "<string>",
"expiration_days": 42,
"initial_price": 6.9,
"internal_notes": "<string>",
"legacy_payment_method_controls": True,
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"renewal_price": 6.9,
"stock": 42,
"trial_period_days": 42,
"unlimited_stock": True
},
"product_id": "prod_xxxxxxxxxxxxx",
"subscription_billing_anchor_at": "2023-12-01T05:00:00.401Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'automatically_finalizes_at' => '2023-12-01T05:00:00.401Z',
'billing_address' => [
'city' => '<string>',
'country' => '<string>',
'line1' => '<string>',
'line2' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'tax_id_value' => '<string>'
],
'charge_buyer_fee' => true,
'customer_name' => '<string>',
'due_date' => '2023-12-01T05:00:00.401Z',
'email_address' => '<string>',
'line_items' => [
[
'label' => '<string>',
'unit_price' => 6.9,
'quantity' => 6.9
]
],
'mailing_address_id' => 'ma_xxxxxxxxxxxxxxx',
'member_id' => 'mber_xxxxxxxxxxxxx',
'payment_method_id' => 'pmt_xxxxxxxxxxxxxx',
'plan' => [
'adaptive_pricing_enabled' => true,
'billing_period' => 42,
'custom_fields' => [
[
'field_type' => '<string>',
'name' => '<string>',
'id' => '<string>',
'order' => 42,
'placeholder' => '<string>',
'required' => true
]
],
'description' => '<string>',
'expiration_days' => 42,
'initial_price' => 6.9,
'internal_notes' => '<string>',
'legacy_payment_method_controls' => true,
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'renewal_price' => 6.9,
'stock' => 42,
'trial_period_days' => 42,
'unlimited_stock' => true
],
'product_id' => 'prod_xxxxxxxxxxxxx',
'subscription_billing_anchor_at' => '2023-12-01T05:00:00.401Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whop.com/api/v1/invoices/{id}"
payload := strings.NewReader("{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.whop.com/api/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-12-01T05:00:00.401Z",
"current_plan": {
"formatted_price": "$10.00",
"id": "plan_xxxxxxxxxxxxx"
},
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "customer@example.com",
"fetch_invoice_token": "eyJhbGciOiJIUzI1NiJ9...",
"id": "inv_xxxxxxxxxxxxxx",
"line_items": [
{
"label": "Platform subscription",
"position": 42,
"quantity": 6.9,
"total": 6.9,
"unit_price": 6.9
}
],
"number": "#0001",
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}{
"error": null
}{
"error": null
}{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}Update invoice
Update a draft invoice’s details.
Required permissions:
invoice:update
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.update('inv_xxxxxxxxxxxxxx');
console.log(invoice.id);curl --request PATCH \
--url https://api.whop.com/api/v1/invoices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"automatically_finalizes_at": "2023-12-01T05:00:00.401Z",
"billing_address": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"tax_id_value": "<string>"
},
"charge_buyer_fee": true,
"customer_name": "<string>",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "<string>",
"line_items": [
{
"label": "<string>",
"unit_price": 6.9,
"quantity": 6.9
}
],
"mailing_address_id": "ma_xxxxxxxxxxxxxxx",
"member_id": "mber_xxxxxxxxxxxxx",
"payment_method_id": "pmt_xxxxxxxxxxxxxx",
"plan": {
"adaptive_pricing_enabled": true,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": true
}
],
"description": "<string>",
"expiration_days": 42,
"initial_price": 6.9,
"internal_notes": "<string>",
"legacy_payment_method_controls": true,
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"renewal_price": 6.9,
"stock": 42,
"trial_period_days": 42,
"unlimited_stock": true
},
"product_id": "prod_xxxxxxxxxxxxx",
"subscription_billing_anchor_at": "2023-12-01T05:00:00.401Z"
}
'import requests
url = "https://api.whop.com/api/v1/invoices/{id}"
payload = {
"automatically_finalizes_at": "2023-12-01T05:00:00.401Z",
"billing_address": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"tax_id_value": "<string>"
},
"charge_buyer_fee": True,
"customer_name": "<string>",
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "<string>",
"line_items": [
{
"label": "<string>",
"unit_price": 6.9,
"quantity": 6.9
}
],
"mailing_address_id": "ma_xxxxxxxxxxxxxxx",
"member_id": "mber_xxxxxxxxxxxxx",
"payment_method_id": "pmt_xxxxxxxxxxxxxx",
"plan": {
"adaptive_pricing_enabled": True,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": True
}
],
"description": "<string>",
"expiration_days": 42,
"initial_price": 6.9,
"internal_notes": "<string>",
"legacy_payment_method_controls": True,
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"renewal_price": 6.9,
"stock": 42,
"trial_period_days": 42,
"unlimited_stock": True
},
"product_id": "prod_xxxxxxxxxxxxx",
"subscription_billing_anchor_at": "2023-12-01T05:00:00.401Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'automatically_finalizes_at' => '2023-12-01T05:00:00.401Z',
'billing_address' => [
'city' => '<string>',
'country' => '<string>',
'line1' => '<string>',
'line2' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'tax_id_value' => '<string>'
],
'charge_buyer_fee' => true,
'customer_name' => '<string>',
'due_date' => '2023-12-01T05:00:00.401Z',
'email_address' => '<string>',
'line_items' => [
[
'label' => '<string>',
'unit_price' => 6.9,
'quantity' => 6.9
]
],
'mailing_address_id' => 'ma_xxxxxxxxxxxxxxx',
'member_id' => 'mber_xxxxxxxxxxxxx',
'payment_method_id' => 'pmt_xxxxxxxxxxxxxx',
'plan' => [
'adaptive_pricing_enabled' => true,
'billing_period' => 42,
'custom_fields' => [
[
'field_type' => '<string>',
'name' => '<string>',
'id' => '<string>',
'order' => 42,
'placeholder' => '<string>',
'required' => true
]
],
'description' => '<string>',
'expiration_days' => 42,
'initial_price' => 6.9,
'internal_notes' => '<string>',
'legacy_payment_method_controls' => true,
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'renewal_price' => 6.9,
'stock' => 42,
'trial_period_days' => 42,
'unlimited_stock' => true
],
'product_id' => 'prod_xxxxxxxxxxxxx',
'subscription_billing_anchor_at' => '2023-12-01T05:00:00.401Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whop.com/api/v1/invoices/{id}"
payload := strings.NewReader("{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.whop.com/api/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"automatically_finalizes_at\": \"2023-12-01T05:00:00.401Z\",\n \"billing_address\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"tax_id_value\": \"<string>\"\n },\n \"charge_buyer_fee\": true,\n \"customer_name\": \"<string>\",\n \"due_date\": \"2023-12-01T05:00:00.401Z\",\n \"email_address\": \"<string>\",\n \"line_items\": [\n {\n \"label\": \"<string>\",\n \"unit_price\": 6.9,\n \"quantity\": 6.9\n }\n ],\n \"mailing_address_id\": \"ma_xxxxxxxxxxxxxxx\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"payment_method_id\": \"pmt_xxxxxxxxxxxxxx\",\n \"plan\": {\n \"adaptive_pricing_enabled\": true,\n \"billing_period\": 42,\n \"custom_fields\": [\n {\n \"field_type\": \"<string>\",\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"order\": 42,\n \"placeholder\": \"<string>\",\n \"required\": true\n }\n ],\n \"description\": \"<string>\",\n \"expiration_days\": 42,\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"legacy_payment_method_controls\": true,\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"renewal_price\": 6.9,\n \"stock\": 42,\n \"trial_period_days\": 42,\n \"unlimited_stock\": true\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"subscription_billing_anchor_at\": \"2023-12-01T05:00:00.401Z\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-12-01T05:00:00.401Z",
"current_plan": {
"formatted_price": "$10.00",
"id": "plan_xxxxxxxxxxxxx"
},
"due_date": "2023-12-01T05:00:00.401Z",
"email_address": "customer@example.com",
"fetch_invoice_token": "eyJhbGciOiJIUzI1NiJ9...",
"id": "inv_xxxxxxxxxxxxxx",
"line_items": [
{
"label": "Platform subscription",
"position": 42,
"quantity": 6.9,
"total": 6.9,
"unit_price": 6.9
}
],
"number": "#0001",
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}{
"error": null
}{
"error": null
}{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}Authorizations
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 ***************************
Path Parameters
The unique identifier of the invoice to update.
"inv_xxxxxxxxxxxxxx"
Body
Parameters for UpdateInvoice
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.
"2023-12-01T05:00:00.401Z"
Inline billing address to create or update a mailing address for this invoice.
Show child attributes
Show child attributes
Whether to charge the customer a buyer fee on this invoice.
How the invoice should be collected.
send_invoice, charge_automatically The name of the customer.
The date by which the invoice must be paid.
"2023-12-01T05:00:00.401Z"
The email address of the customer.
Line items that break down the invoice total.
Show child attributes
Show child attributes
The unique identifier of an existing mailing address to attach.
"ma_xxxxxxxxxxxxxxx"
The unique identifier of a member to assign as the customer.
"mber_xxxxxxxxxxxxx"
The unique identifier of the payment method to charge.
"pmt_xxxxxxxxxxxxxx"
Updated plan attributes.
Show child attributes
Show child attributes
The unique identifier of an existing product to attach to this invoice. Only allowed while the invoice is still a draft.
"prod_xxxxxxxxxxxxx"
The date that defines when the subscription billing cycle should start.
"2023-12-01T05:00:00.401Z"
Response
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 datetime the invoice was created.
"2023-12-01T05:00:00.401Z"
The plan that this invoice charges for.
Show child attributes
Show child attributes
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 unique identifier for the invoice.
"inv_xxxxxxxxxxxxxx"
Optional line items that break down the invoice total into individual charges.
Show child attributes
Show child attributes
The sequential invoice number for display purposes.
"#0001"
The current payment status of the invoice, such as draft, open, paid, or void.
draft, open, paid, past_due, uncollectible, void The user this invoice is addressed to. Null if the user account has been removed.
Show child attributes
Show child attributes

