# Creates a subscription

Creates a Subscription object.

After you created the subscription it will either be started immediately or at the start_date when a mandate was given. When pay_methods are given you need to redirect the customer to the checkout link in the links section.

Endpoint: POST /subscriptions
Version: v1
Security: apiKey

## Request fields (application/json):

  - `customer` (string, required)
    ID of the customer that subscribes. Cannot be used together with a mandate.
    Example: "CUW78XU8BYL8X6"

  - `description` (string, required)
    Description of the subscription. This will be shown to customers and in the PayPro dashboard
    Example: "description"

  - `mandate` (string,null)
    Mandate that will be used for the subscription. Using this will start the subscription immediately. Cannot be used together with the pay_methods field.

  - `currency` (string, required)
    The currency of the subscription. Only 'EUR' is supported
    Example: "EUR"

  - `start_at` (string,null)
    Date when the subscription will start. When left empty, it will start at creation
    Example: "2023-08-01"

  - `cancel_at` (string,null)
    Date at which the subscription will be canceled. When left empty, the subscription will be active until manually canceled

  - `pay_methods` (array,null)
    Pay methods that can be used to start the subscription. Using this creates the subscription with the authorization flow and will start the subscription when the first payment is paid. Use the checkout link in the links field to redirect the customer. Cannot be used together with a mandate.
    Enum: "bancontact", "bank-transfer", "creditcard", "direct-debit", "ideal", "ideal-qr", "klarna-paynow"

  - `payment_details` (object)
    Fields to be passed to the authorization payment.

  - `payment_details.return_url` (string,null)
    The URL where the customer will be send to after the payment has been processed.

  - `payment_details.cancel_url` (string,null)
    The URL where the customer will be send to after the payment has been canceled by the customer.

  - `payment_details.issuer` (string,null)
    Specifying the iDEAL issuer is deprecated and will be ignored if provided.
    Enum: "SNSBNL2A", "ASNBNL21", "ABNANL2A", "BUNQNL2A", "KNABNL2H", "RABONL2U", "REVOLT21", "RBRBNL21", "TRIONL2U", "FVLBNL22", "INGBNL2A", "BITSNL2A", "NTSBDEB1", "NNBANL2G"

  - `period` (object, required)
    Settings for when new periods should be created and with which amounts
    Example: {"amount":1000,"vat":21,"multiplier":1,"type":"month"}

  - `period.amount` (integer)
    The amount in cents that the customer will have to pay.
    Example: 1000

  - `period.vat` (number,null)
    The vat included in the amount. Accepted values: from 0 till 30
    Example: 21

  - `period.interval` (string)
    The interval of each period. Accepted values: day, week, month or year

  - `period.multiplier` (integer)
    The multiplier of the interval between periods. Example: interval=month and mulitplier=3 will create a new period every 3 months.
    Example: 1

  - `first_period` (object,null)
    Settings for when the first period should be created and with what amount

  - `first_period.amount` (integer)
    The amount in cents that the customer will have to pay.

  - `first_period.vat` (number,null)
    The vat included in the amount. Accepted values: from 0 till 30

  - `first_period.interval` (string)
    The interval of each period. Accepted values: day, week, month or year

  - `first_period.multiplier` (integer)
    The multiplier of the interval between periods. Example: interval=month and mulitplier=3 will create a new period every 3 months.

  - `metadata` (object,null)
    You can put in random data that you like to save alongside the subscription. When you fetch the subscription this will be returned in the metadata field.

## Response 201 fields (application/json):

  - `id` (string, required)
    Example: "PSV1QACRO4DSMQT0KK"

  - `type` (string, required)
    Enum: "subscription"

  - `description` (string, required)
    Example: "Test subscription"

  - `subscription_type` (string,null, required)
    Enum: "direct_debit"

  - `state` (string, required)
    Example: "active"

  - `currency` (string, required)
    Enum: "EUR"

  - `created_at` (string, required)
    Example: "2023-07-24T12:40:10Z"

  - `start_at` (string,null, required)

  - `cancel_at` (string,null, required)

  - `customer` (string,null, required)
    Example: "CU7JRN6W6K3DA9"

  - `mandate` (string,null, required)
    Example: "MD6ULYXJ4HP9RJ"

  - `scheduling` (string,null)
    Enum: "manual", "automatic"

  - `cancel_periods_on_cancellation` (boolean)

  - `period` (object,null, required)
    Example: {"amount":"1000","vat":"21","multiplier":1,"interval":"month"}

  - `period.amount` (integer, required)
    Example: "1000"

  - `period.vat` (number, required)
    Example: "21"

  - `period.multiplier` (integer, required)
    Example: 1

  - `period.interval` (string, required)
    Enum: "day", "week", "month", "year"

  - `first_period` (object,null, required)
    Example: {"amount":"1000","vat":"21","multiplier":1,"interval":"month"}

  - `first_period.amount` (integer, required)
    Example: "1000"

  - `first_period.vat` (number, required)
    Example: "21"

  - `first_period.multiplier` (integer)
    Example: 1

  - `first_period.interval` (string)
    Enum: same as `period.interval` (4 values)

  - `payment_details` (object, required)
    Example: {"return_url":null,"cancel_url":null}

  - `payment_details.return_url` (string,null, required)

  - `payment_details.cancel_url` (string,null, required)

  - `next_period_date` (string,null, required)

  - `available_until` (string,null, required)

  - `metadata` (object, required)
    Example: {}

  - `_links` (object, required)
    Example: {"self":"https://api.paypro.nl/subscriptions/PSV1QACRO4DSMQT0KK","customer":"https://api.paypro.nl/customers/CU7JRN6W6K3DA9","mandate":"https://api.paypro.nl/mandates/MD6ULYXJ4HP9RJ"}

  - `_links.self` (string, required)
    Example: "https://api.paypro.nl/subscriptions/PSV1QACRO4DSMQT0KK"

  - `_links.customer` (string)
    Example: "https://api.paypro.nl/customers/CU7JRN6W6K3DA9"

  - `_links.mandate` (string)
    Example: "https://api.paypro.nl/mandates/MD6ULYXJ4HP9RJ"

  - `_links.checkout` (string)


