import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const checkoutConfiguration = await client.checkoutConfigurations.create();
console.log(checkoutConfiguration.id);curl --request POST \
--url https://api.whop.com/api/v1/checkout_configurations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"company_id": "biz_xxxxxxxxxxxxxx",
"adaptive_pricing_enabled": true,
"application_fee_amount": 6.9,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": true
}
],
"description": "<string>",
"expiration_days": 42,
"force_create_new_plan": true,
"image": {
"id": "<string>"
},
"initial_price": 6.9,
"internal_notes": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"product": {
"external_identifier": "<string>",
"title": "<string>",
"collect_shipping_address": true,
"custom_statement_descriptor": "<string>",
"description": "<string>",
"global_affiliate_percentage": 6.9,
"headline": "<string>",
"product_tax_code_id": "ptc_xxxxxxxxxxxxxx",
"redirect_purchase_url": "<string>",
"route": "<string>"
},
"product_id": "prod_xxxxxxxxxxxxx",
"renewal_price": 6.9,
"split_pay_required_payments": 42,
"stock": 42,
"title": "<string>",
"trial_period_days": 42
},
"affiliate_code": "<string>",
"checkout_styling": {
"background_color": "<string>",
"button_color": "<string>"
},
"metadata": {},
"mode": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"redirect_url": "<string>"
}
'import requests
url = "https://api.whop.com/api/v1/checkout_configurations"
payload = {
"plan": {
"company_id": "biz_xxxxxxxxxxxxxx",
"adaptive_pricing_enabled": True,
"application_fee_amount": 6.9,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": True
}
],
"description": "<string>",
"expiration_days": 42,
"force_create_new_plan": True,
"image": { "id": "<string>" },
"initial_price": 6.9,
"internal_notes": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"product": {
"external_identifier": "<string>",
"title": "<string>",
"collect_shipping_address": True,
"custom_statement_descriptor": "<string>",
"description": "<string>",
"global_affiliate_percentage": 6.9,
"headline": "<string>",
"product_tax_code_id": "ptc_xxxxxxxxxxxxxx",
"redirect_purchase_url": "<string>",
"route": "<string>"
},
"product_id": "prod_xxxxxxxxxxxxx",
"renewal_price": 6.9,
"split_pay_required_payments": 42,
"stock": 42,
"title": "<string>",
"trial_period_days": 42
},
"affiliate_code": "<string>",
"checkout_styling": {
"background_color": "<string>",
"button_color": "<string>"
},
"metadata": {},
"mode": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"redirect_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/checkout_configurations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'plan' => [
'company_id' => 'biz_xxxxxxxxxxxxxx',
'adaptive_pricing_enabled' => true,
'application_fee_amount' => 6.9,
'billing_period' => 42,
'custom_fields' => [
[
'field_type' => '<string>',
'name' => '<string>',
'id' => '<string>',
'order' => 42,
'placeholder' => '<string>',
'required' => true
]
],
'description' => '<string>',
'expiration_days' => 42,
'force_create_new_plan' => true,
'image' => [
'id' => '<string>'
],
'initial_price' => 6.9,
'internal_notes' => '<string>',
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'product' => [
'external_identifier' => '<string>',
'title' => '<string>',
'collect_shipping_address' => true,
'custom_statement_descriptor' => '<string>',
'description' => '<string>',
'global_affiliate_percentage' => 6.9,
'headline' => '<string>',
'product_tax_code_id' => 'ptc_xxxxxxxxxxxxxx',
'redirect_purchase_url' => '<string>',
'route' => '<string>'
],
'product_id' => 'prod_xxxxxxxxxxxxx',
'renewal_price' => 6.9,
'split_pay_required_payments' => 42,
'stock' => 42,
'title' => '<string>',
'trial_period_days' => 42
],
'affiliate_code' => '<string>',
'checkout_styling' => [
'background_color' => '<string>',
'button_color' => '<string>'
],
'metadata' => [
],
'mode' => '<string>',
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'redirect_url' => '<string>'
]),
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/checkout_configurations"
payload := strings.NewReader("{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.whop.com/api/v1/checkout_configurations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/checkout_configurations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"affiliate_code": "<string>",
"company_id": "<string>",
"id": "ch_xxxxxxxxxxxxxxx",
"metadata": {},
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"plan": {
"adaptive_pricing_enabled": true,
"billing_period": 42,
"expiration_days": 42,
"id": "plan_xxxxxxxxxxxxx",
"initial_price": 6.9,
"renewal_price": 6.9,
"trial_period_days": 42
},
"purchase_url": "<string>",
"redirect_url": "<string>"
}{
"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"
}
}Create checkout configuration
Creates a new checkout configuration
Required permissions:
checkout_configuration:createplan:createaccess_pass:createaccess_pass:updatecheckout_configuration:basic:read
import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const checkoutConfiguration = await client.checkoutConfigurations.create();
console.log(checkoutConfiguration.id);curl --request POST \
--url https://api.whop.com/api/v1/checkout_configurations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"company_id": "biz_xxxxxxxxxxxxxx",
"adaptive_pricing_enabled": true,
"application_fee_amount": 6.9,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": true
}
],
"description": "<string>",
"expiration_days": 42,
"force_create_new_plan": true,
"image": {
"id": "<string>"
},
"initial_price": 6.9,
"internal_notes": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"product": {
"external_identifier": "<string>",
"title": "<string>",
"collect_shipping_address": true,
"custom_statement_descriptor": "<string>",
"description": "<string>",
"global_affiliate_percentage": 6.9,
"headline": "<string>",
"product_tax_code_id": "ptc_xxxxxxxxxxxxxx",
"redirect_purchase_url": "<string>",
"route": "<string>"
},
"product_id": "prod_xxxxxxxxxxxxx",
"renewal_price": 6.9,
"split_pay_required_payments": 42,
"stock": 42,
"title": "<string>",
"trial_period_days": 42
},
"affiliate_code": "<string>",
"checkout_styling": {
"background_color": "<string>",
"button_color": "<string>"
},
"metadata": {},
"mode": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"redirect_url": "<string>"
}
'import requests
url = "https://api.whop.com/api/v1/checkout_configurations"
payload = {
"plan": {
"company_id": "biz_xxxxxxxxxxxxxx",
"adaptive_pricing_enabled": True,
"application_fee_amount": 6.9,
"billing_period": 42,
"custom_fields": [
{
"field_type": "<string>",
"name": "<string>",
"id": "<string>",
"order": 42,
"placeholder": "<string>",
"required": True
}
],
"description": "<string>",
"expiration_days": 42,
"force_create_new_plan": True,
"image": { "id": "<string>" },
"initial_price": 6.9,
"internal_notes": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"product": {
"external_identifier": "<string>",
"title": "<string>",
"collect_shipping_address": True,
"custom_statement_descriptor": "<string>",
"description": "<string>",
"global_affiliate_percentage": 6.9,
"headline": "<string>",
"product_tax_code_id": "ptc_xxxxxxxxxxxxxx",
"redirect_purchase_url": "<string>",
"route": "<string>"
},
"product_id": "prod_xxxxxxxxxxxxx",
"renewal_price": 6.9,
"split_pay_required_payments": 42,
"stock": 42,
"title": "<string>",
"trial_period_days": 42
},
"affiliate_code": "<string>",
"checkout_styling": {
"background_color": "<string>",
"button_color": "<string>"
},
"metadata": {},
"mode": "<string>",
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": True
},
"redirect_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/checkout_configurations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'plan' => [
'company_id' => 'biz_xxxxxxxxxxxxxx',
'adaptive_pricing_enabled' => true,
'application_fee_amount' => 6.9,
'billing_period' => 42,
'custom_fields' => [
[
'field_type' => '<string>',
'name' => '<string>',
'id' => '<string>',
'order' => 42,
'placeholder' => '<string>',
'required' => true
]
],
'description' => '<string>',
'expiration_days' => 42,
'force_create_new_plan' => true,
'image' => [
'id' => '<string>'
],
'initial_price' => 6.9,
'internal_notes' => '<string>',
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'product' => [
'external_identifier' => '<string>',
'title' => '<string>',
'collect_shipping_address' => true,
'custom_statement_descriptor' => '<string>',
'description' => '<string>',
'global_affiliate_percentage' => 6.9,
'headline' => '<string>',
'product_tax_code_id' => 'ptc_xxxxxxxxxxxxxx',
'redirect_purchase_url' => '<string>',
'route' => '<string>'
],
'product_id' => 'prod_xxxxxxxxxxxxx',
'renewal_price' => 6.9,
'split_pay_required_payments' => 42,
'stock' => 42,
'title' => '<string>',
'trial_period_days' => 42
],
'affiliate_code' => '<string>',
'checkout_styling' => [
'background_color' => '<string>',
'button_color' => '<string>'
],
'metadata' => [
],
'mode' => '<string>',
'payment_method_configuration' => [
'disabled' => [
],
'enabled' => [
],
'include_platform_defaults' => true
],
'redirect_url' => '<string>'
]),
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/checkout_configurations"
payload := strings.NewReader("{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.whop.com/api/v1/checkout_configurations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/checkout_configurations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan\": {\n \"company_id\": \"biz_xxxxxxxxxxxxxx\",\n \"adaptive_pricing_enabled\": true,\n \"application_fee_amount\": 6.9,\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 \"force_create_new_plan\": true,\n \"image\": {\n \"id\": \"<string>\"\n },\n \"initial_price\": 6.9,\n \"internal_notes\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"product\": {\n \"external_identifier\": \"<string>\",\n \"title\": \"<string>\",\n \"collect_shipping_address\": true,\n \"custom_statement_descriptor\": \"<string>\",\n \"description\": \"<string>\",\n \"global_affiliate_percentage\": 6.9,\n \"headline\": \"<string>\",\n \"product_tax_code_id\": \"ptc_xxxxxxxxxxxxxx\",\n \"redirect_purchase_url\": \"<string>\",\n \"route\": \"<string>\"\n },\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"renewal_price\": 6.9,\n \"split_pay_required_payments\": 42,\n \"stock\": 42,\n \"title\": \"<string>\",\n \"trial_period_days\": 42\n },\n \"affiliate_code\": \"<string>\",\n \"checkout_styling\": {\n \"background_color\": \"<string>\",\n \"button_color\": \"<string>\"\n },\n \"metadata\": {},\n \"mode\": \"<string>\",\n \"payment_method_configuration\": {\n \"disabled\": [],\n \"enabled\": [],\n \"include_platform_defaults\": true\n },\n \"redirect_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"affiliate_code": "<string>",
"company_id": "<string>",
"id": "ch_xxxxxxxxxxxxxxx",
"metadata": {},
"payment_method_configuration": {
"disabled": [],
"enabled": [],
"include_platform_defaults": true
},
"plan": {
"adaptive_pricing_enabled": true,
"billing_period": 42,
"expiration_days": 42,
"id": "plan_xxxxxxxxxxxxx",
"initial_price": 6.9,
"renewal_price": 6.9,
"trial_period_days": 42
},
"purchase_url": "<string>",
"redirect_url": "<string>"
}{
"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
An Account API key, account-scoped JWT, App API key, or user OAuth token. Prepend the key or token with Bearer, for example Bearer ***************************.
Body
- CreateCheckoutSessionInputModePaymentWithPlan
- CreateCheckoutSessionInputModePaymentWithPlanId
- CreateCheckoutSessionInputModeSetup
Autogenerated input type of CreateCheckoutSession
The plan attributes to create a new plan inline for this checkout configuration.
Show child attributes
Show child attributes
An affiliate tracking code to attribute the checkout to a specific affiliate.
Checkout styling overrides for this session. Overrides plan and company defaults.
Show child attributes
Show child attributes
The currency for the checkout when in setup mode. Controls which currency-specific payment methods are available. Defaults to USD when in setup mode.
usd, sgd, inr, aud, brl, cad, dkk, eur, nok, gbp, sek, chf, hkd, huf, jpy, mxn, myr, pln, czk, nzd, aed, eth, ape, cop, ron, thb, bgn, idr, dop, php, try, krw, twd, vnd, pkr, clp, uyu, ars, zar, dzd, tnd, mad, kes, kwd, jod, all, xcd, amd, bsd, bhd, bob, bam, khr, crc, xof, egp, etb, gmd, ghs, gtq, gyd, ils, jmd, mop, mga, mur, mdl, mnt, nad, ngn, mkd, omr, pyg, pen, qar, rwf, sar, rsd, lkr, tzs, ttd, uzs, rub, btc, cny, usdt, kzt, awg, whop_usd, xau Custom key-value metadata to attach to the checkout configuration.
"payment"The explicit payment method configuration for the checkout session. Only applies to setup mode. If not provided, the platform or company defaults will apply.
Show child attributes
Show child attributes
The URL to redirect the user to after checkout is completed.
Response
A successful response
A checkout configuration is a reusable configuration for a checkout, including the plan, affiliate, and custom metadata. Payments and memberships created from a checkout session inherit its metadata.
The affiliate code to use for the checkout configuration
The ID of the company to use for the checkout configuration
The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode.
usd, sgd, inr, aud, brl, cad, dkk, eur, nok, gbp, sek, chf, hkd, huf, jpy, mxn, myr, pln, czk, nzd, aed, eth, ape, cop, ron, thb, bgn, idr, dop, php, try, krw, twd, vnd, pkr, clp, uyu, ars, zar, dzd, tnd, mad, kes, kwd, jod, all, xcd, amd, bsd, bhd, bob, bam, khr, crc, xof, egp, etb, gmd, ghs, gtq, gyd, ils, jmd, mop, mga, mur, mdl, mnt, nad, ngn, mkd, omr, pyg, pen, qar, rwf, sar, rsd, lkr, tzs, ttd, uzs, rub, btc, cny, usdt, kzt, awg, whop_usd, xau The unique identifier for the checkout session.
"ch_xxxxxxxxxxxxxxx"
The metadata to use for the checkout configuration
The mode of the checkout session.
payment, setup The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.
Show child attributes
Show child attributes
The plan to use for the checkout configuration
Show child attributes
Show child attributes
A URL you can send to customers to complete a checkout. It looks like /checkout/plan_xxxx?session={id}
The URL to redirect the user to after the checkout configuration is created

