> ## Documentation Index
> Fetch the complete documentation index at: https://docs-int.wingback.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe Customer to a Plan

export const IntRedir = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    setTimeout(() => {
      const currentUrl = new URL(window.location.href);
      if (currentUrl.hostname === 'docs-int.wingback.com') {
        currentUrl.hostname = 'docs.wingback.com';
        window.location.replace(currentUrl.toString());
      }
    }, 1);
    return <></>;
  }
};

<IntRedir />


## OpenAPI

````yaml POST /v1/c/contract
openapi: 3.0.3
info:
  title: wingback-api
  description: ''
  contact:
    name: ''
  license:
    name: commercial
  version: 0.1.0
servers:
  - url: http://127.0.0.1:8080
    description: Local server
  - url: https://api.app.test.wingback.com
    description: Testing server
security: []
paths:
  /v1/c/contract:
    post:
      tags:
        - contract
      summary: Create/Sign a new Contract
      operationId: insert_contract
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/inbound.contract.Sign'
        required: true
      responses:
        '200':
          description: Updated
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: string
              example: Cont_cc871a3a-2b38-4689-a32d-14bf2e62b1ae
      security:
        - api-key: []
        - wb_user_cookie: []
components:
  schemas:
    inbound.contract.Sign:
      type: object
      description: Configuration used by a WbCustomer to sign up a Customer to a plan
      required:
        - plan
        - customer
        - cycle
        - currency
      properties:
        activation:
          type: string
          format: date-time
          description: Contract activation date. Immediate if empty
          nullable: true
        automatic_payment:
          type: boolean
          description: >-
            Whether the Customer should be charged by Wingback Billing Engine or
            not

            If not set, the configuration from Customer profile will be used,
            and if that is not set

            either, the default configuration for WbCustomer will be used
          nullable: true
        currency:
          $ref: '#/components/schemas/Currency'
        customer:
          $ref: '#/components/schemas/Id'
        cycle:
          $ref: '#/components/schemas/Cycle'
        discount_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        feature_configuration:
          type: object
          description: >-
            Configuration specifying overrides to apply to new plan during
            contract upgrade.

            In addition to the number of units to purchase, it is possible to

            override price and flat_fee of specific features to create
            customized plans

            See FeatureConfiguration for format
          additionalProperties:
            $ref: '#/components/schemas/FeatureConfigurationInternal'
          nullable: true
        free_trial_days:
          type: integer
          description: The optional custom number of days on free trial
          nullable: true
          minimum: 0
        invoice_trigger:
          allOf:
            - $ref: '#/components/schemas/InvoiceTrigger'
          nullable: true
        is_pending:
          type: boolean
          description: >-
            Creates a pending contract. Pending contract has no activation date,
            and can only

            be activated manually. Activation date is ignored if this is set to
            true.

            Defaults to false
        plan:
          $ref: '#/components/schemas/Id'
        pricing_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        unit_count_configuration:
          type: object
          description: >-
            Configuration specifying the number of units to purchase

            on the new plan for unit-based features. This is a hashmap where

            keys are slugs of features, and values are the numbers of units to
            purchase

            {

            "{feature_slug}": {number_of_units}

            }
          additionalProperties:
            type: string
          deprecated: true
          nullable: true
    Currency:
      type: string
      description: |-
        A supported currency

        The format for parsing and reading is the lowercased
        ISO 4217 currency code (e.g. "usd")
      enum:
        - usd
        - eur
        - gbp
        - brl
        - ars
    Id:
      type: string
      description: >-
        Unique identifier of an object. Consists of object class prefix and a
        UUID
      example: Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670
    Cycle:
      type: string
      description: |-
        Enum that lists supported payment cycles for contracts:
        * Once - one-time payment
        * Constant - one-time payment for the duration of the contract
        * Week - contract is paid weekly
        * Month - contract is paid monthly
        * Quarter - contract is paid every quarter
        * Year - contract is paid yearly
      enum:
        - once
        - hour
        - day
        - week
        - month
        - quarter
        - year
        - constant
    FeatureConfigurationInternal:
      type: object
      description: >-
        Helper structure to store the overridden price and flat_fee for
        customized

        contracts, as well as the number of units being purchased for the
        contract
      properties:
        flat_fee:
          type: string
          description: the overridden flat_fee for the usage-based feature
          nullable: true
        price:
          type: string
          description: the overridden price of the given feature
          nullable: true
        purchased:
          type: boolean
          description: >-
            used for optional features - the optional feature is added to the
            contract only if this

            is set to `true`
          nullable: true
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/Tier'
          description: Override tiers
          nullable: true
        unit_count:
          type: string
          description: the number of units being purchased
          nullable: true
    InvoiceTrigger:
      oneOf:
        - type: string
          description: invoices are created as soon as invoice items are validated
          enum:
            - immediate
        - type: object
          required:
            - periodic
          properties:
            periodic:
              $ref: '#/components/schemas/UnboundedPeriodRule'
        - type: string
          description: invoices are created on wb_customer action
          enum:
            - manual
      description: |-
        When the invoices should be created

        Note: EveryCycle and Periodic aren't yet supported,
        they will behave as Manual
    Tier:
      type: object
      description: A pricing tier
      required:
        - tier_start
        - tier_end
        - amount
      properties:
        amount:
          type: string
          description: Price per unit for this tier
        tier_end:
          $ref: '#/components/schemas/TierValue'
        tier_start:
          type: string
          description: Number of units where this tier starts applying.
    UnboundedPeriodRule:
      type: object
      description: |-
        How period are generated, independently from a start
        or end
      required:
        - cycle_count
        - cycle
      properties:
        cycle:
          $ref: '#/components/schemas/TriggerCycle'
        cycle_count:
          type: integer
          description: the number of days/week/month etc. in a period
          minimum: 0
        cycle_start_offset:
          type: integer
          description: |-
            Number of full days between the cycle's natural start and
            the claims starts. For example if claims are to start on
            the morning of the 14 each month, the offset will be 13.
            This value can be null, meaning either that it's not
            specified at this level (eg in preferences) or that it's
            0 (ie a natural cycle)
          nullable: true
          minimum: 0
    TierValue:
      oneOf:
        - type: object
          required:
            - Concrete
          properties:
            Concrete:
              type: string
        - type: string
          enum:
            - Infinity
      description: Either a number of `infinity`. Must be a string
    TriggerCycle:
      type: string
      description: |-
        Enum that lists supported trigger cycles for periodic triggers:
        * Month - every month
        * Quarter - every quarter
        * Year - every year
      enum:
        - day
        - week
        - month
        - quarter
        - year
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: wb-key
    wb_user_cookie:
      type: apiKey
      in: cookie
      name: app-session

````