# Create a plan

Creates a new plan object.

Endpoint: POST /plans
Version: 1.0.0
Security: BasicAuth

## Request fields (application/x-www-form-urlencoded):

  - `amount` (integer, required)
    Subscription charge amount in minor units of the given currency. For example, 10€ is represented as "1000" and 10¥ is represented as "10".
    Example: 499

  - `currency` (string, required)
    Subscription charge currency represented as a three-letter ISO currency code.
    Example: USD

  - `interval` (string, required)
    Frequency of the subscription charges.
    Enum: "hour", "day", "week", "month", "year"

  - `name` (string, required)
    Display name of this plan.
    Example: Example plan

  - `intervalCount` (integer)
    Number of intervals between the subscription charges. For example, interval=day and intervalCount=10 will result in a charge every 10 days.
    Example: 10

  - `billingCycles` (integer)
    Number of charges after which the subscription will be automatically canceled. Value of null means no limit on the number of charges. Required for a plan that recurs to another plan.
    Example: 12

  - `trialPeriodDays` (integer)
    Number of days between the creation of the subscription and the first charge.
    Example: 0

  - `recursTo` (string)
    When the subscription is automatically canceled (due to reaching the limit of billingCycles), it will move to the plan defined by this attribute.
    Example: plan_kFvuXpO2yhAFhbxTEaqm4HDW

  - `splits` (array)
    Allows to transfer part of a charge amount to the given merchant. Applied to every charge made within this plan. The amount of splits cannot be greater than 75% of that charge amount. Only one split is allowed. The merchant the money is transferred to must be a platform.

  - `splits.type` (string, required)
    Split type.
    Enum: "tip"

  - `splits.merchant` (string, required)
    Identifier of the platform merchant the money is transferred to.
    Example: mrc_gTDpVZkFqOqSqD3MWRQkGYI7

  - `splits.amount` (integer, required)
    Amount to transfer, in the smallest currency unit. Must be positive.
    Example: 100

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier for the plan
    Example: plan_bLu3vzO8yhAFhbxFEadm6HUV

  - `created` (integer)
    Unix timestamp when the plan was created
    Example: 1711929600

  - `objectType` (string)
    Object type identifier
    Enum: "plan"

  - `amount` (integer)
    Subscription charge amount in minor units of the given currency. For example, 10€ is represented as "1000" and 10¥ is represented as "10".
    Example: 499

  - `currency` (string)
    Subscription charge currency represented as a three-letter ISO currency code.
    Example: USD

  - `interval` (string)
    Frequency of subscription charges.
    Enum: "hour", "day", "week", "month", "year"

  - `intervalCount` (integer)
    Number of intervals between subscription charges. For example, interval=day and intervalCount=10 will result in a charge every 10 days.
    Example: 10

  - `billingCycles` (integer)
    Number of charges after which the subscription will be automatically canceled. Value of null means no limit on the number of charges.
    Example: 12

  - `name` (string)
    Display name of this plan
    Example: Example plan

  - `trialPeriodDays` (integer)
    Number of days between the creation of the subscription and the first charge.
    Example: 0

  - `recursTo` (string)
    When the subscription is automatically canceled (due to reaching the limit of billingCycles), it will move to the plan defined by this attribute.
    Example: plan_kFvuXpO2yhAFhbxTEaqm4HDW

  - `splits` (array)
    Information about split requests defined when creating the plan. Charge splits require a platform account.

  - `splits.type` (string, required)
    Split type.
    Enum: "tip"

  - `splits.merchant` (string, required)
    Identifier of the platform merchant the money is transferred to.
    Example: mrc_gTDpVZkFqOqSqD3MWRQkGYI7

  - `splits.amount` (integer, required)
    Amount to transfer, in the smallest currency unit. Must be positive.
    Example: 100

## Response 400 fields (application/json):

  - `error` (object)

  - `error.type` (string)
    Error type
    Enum: "invalid_request", "card_error", "gateway_error"

  - `error.code` (string)
    Machine-readable error code
    Example: invalid_number

  - `error.message` (string)
    Human-readable error message
    Example: Requested object does not exist

  - `error.chargeId` (string)
    ID of the charge associated with this error (if applicable)
    Example: char_ORVCrwOrTkGsDwM3H50OIW7Q

