Skip to main content
POST
/
checkout_configurations
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: 'My API Key',
});

const checkoutConfiguration = await client.checkoutConfigurations.create({
  plan: { company_id: 'biz_xxxxxxxxxxxxxx', currency: 'usd' },
});

console.log(checkoutConfiguration.id);
{
  "id": "ch_xxxxxxxxxxxxxxx",
  "company_id": "<string>",
  "mode": "payment",
  "plan": {
    "id": "plan_xxxxxxxxxxxxx",
    "visibility": "visible",
    "plan_type": "renewal",
    "release_method": "buy_now",
    "currency": "usd",
    "billing_period": 42,
    "expiration_days": 42,
    "initial_price": 6.9,
    "renewal_price": 6.9,
    "trial_period_days": 42
  },
  "affiliate_code": "<string>",
  "metadata": {},
  "redirect_url": "<string>",
  "purchase_url": "<string>",
  "payment_method_configuration": {
    "enabled": [
      "acss_debit"
    ],
    "disabled": [
      "acss_debit"
    ],
    "include_platform_defaults": true
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
  • CreateCheckoutSessionInputModePaymentWithPlan
  • CreateCheckoutSessionInputModePaymentWithPlanId
  • CreateCheckoutSessionInputModeSetup

Parameters for CreateCheckoutSession Autogenerated input type of CreateCheckoutSession

plan
object
required

Pass this object to create a new plan for this checkout configuration

affiliate_code
string | null

The affiliate code to use for the checkout configuration

metadata
object | null

The metadata to use for the checkout configuration

mode
string
Allowed value: "payment"
payment_method_configuration
object | null

This currently only works for configurations made in 'setup' mode. The explicit payment method configuration for the checkout session. If not provided, the platform or company's defaults will apply.

redirect_url
string | null

The URL to redirect the user to after the checkout configuration is created

Response

A successful response

A checkout configuration object.
Can be used to create a reusable custom configuration for a checkout, including attaching plans, affiliates and custom metadata to the checkout.
This configuration can be re-used by multiple users.
All successful payments and memberships resulting from a checkout will contain the passed metadata.
id
string
required

The ID of the checkout configuration

Example:

"ch_xxxxxxxxxxxxxxx"

company_id
string
required

The ID of the company to use for the checkout configuration

mode
enum<string>
required

The mode of the checkout session.

Available options:
payment,
setup
plan
object | null
required

The plan to use for the checkout configuration

affiliate_code
string | null
required

The affiliate code to use for the checkout configuration

metadata
object | null
required

The metadata to use for the checkout configuration

redirect_url
string | null
required

The URL to redirect the user to after the checkout configuration is created

purchase_url
string
required

A URL you can send to customers to complete a checkout. It looks like /checkout/plan_xxxx?session={id}

payment_method_configuration
object | null
required

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.