# CreateSubscriptionRequest

**amount**int32required

Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge 1.00 USD).

**Example:<!-- -->&#x20;**`110`

**currency**Payment-Currencyrequired

Three-letter [ISO currency code](https://en.wikipedia.org/wiki/ISO_4217), in uppercase. Must be a supported currency.

**Example:<!-- -->&#x20;**`EUR`

**interval**Subscription-Intervalrequired

Subscription interval. The `minute` and `hour` intervals are only available in test mode.

| Enum Value | Description        |
| ---------- | ------------------ |
| minute     | Minutely           |
| hour       | Hourly             |
| day        | Daily              |
| week       | Weekly             |
| month      | Monthly            |
| quarter    | Every three months |
| year       | Yearly             |

**Possible values:** \[`minute`, `hour`, `day`, `week`, `month`, `quarter`, `year`]

**Example:<!-- -->&#x20;**`month`

**intervalCount**int32

Number of intervals between subscription payments.

**Example:<!-- -->&#x20;**`1`

**allowedPaymentMethods**string\[]

List of payment methods allowed for subscriptions.

| Enum Value | Description |
| ---------- | ----------- |
| card       | Card        |
| bizum      | Bizum       |

**Example:<!-- -->&#x20;**`["card","bizum"]`

**description**Subscription-Description

An arbitrary string attached to the subscription. Often useful for displaying to users.

**Example:<!-- -->&#x20;**`MoonMail Monthly Lite`

**customer** <!-- -->object

**email**string

The customer's email address.

**Example:<!-- -->&#x20;**`john.doe@example.com`

**name**string

The customer's full name or business name.

**Example:<!-- -->&#x20;**`John Doe`

**phone**string

The customer's phone number in E.164 format.

**Example:<!-- -->&#x20;**`null`

**billingDetails** <!-- -->object

Billing information associated with the payment method at the time of the transaction.

**name**string

The customer's billing full name.

**Example:<!-- -->&#x20;**`John Doe`

**email**string

The customer's billing email address.

**Example:<!-- -->&#x20;**`john.doe@example.com`

**phone**string

The customer's billing phone number in E.164 format.

**Example:<!-- -->&#x20;**`null`

**company**string

Billing company name.

**Example:<!-- -->&#x20;**`null`

**taxId**string

Company tax ID.

**Example:<!-- -->&#x20;**`null`

**address** <!-- -->object

**country**Country

Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).

**Example:<!-- -->&#x20;**`ES`

**city**string

City, district, suburb, town, or village.

**Example:<!-- -->&#x20;**`Málaga`

**line1**string

Address line 1 (e.g., street, PO Box, or company name).

**Example:<!-- -->&#x20;**`Fake Street 123`

**line2**string

Address line 2 (e.g., apartment, suite, unit, or building).

**Example:<!-- -->&#x20;**`null`

**zip**string

ZIP or postal code.

**Example:<!-- -->&#x20;**`1234`

**state**string

State, county, province, or region.

**Example:<!-- -->&#x20;**`Málaga`

**shippingDetails** <!-- -->object

Shipping information associated with the payment.

**name**string

The shipping customer's full name.

**Example:<!-- -->&#x20;**`John Doe`

**email**string

The shipping customer's email address.

**Example:<!-- -->&#x20;**`john.doe@example.com`

**phone**string

The shipping customer's phone number in E.164 format.

**Example:<!-- -->&#x20;**`null`

**company**string

Name of the company where the shipment is going.

**Example:<!-- -->&#x20;**`null`

**taxId**string

Company tax ID.

**Example:<!-- -->&#x20;**`null`

**address** <!-- -->object

**country**Country

Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).

**Example:<!-- -->&#x20;**`ES`

**city**string

City, district, suburb, town, or village.

**Example:<!-- -->&#x20;**`Málaga`

**line1**string

Address line 1 (e.g., street, PO Box, or company name).

**Example:<!-- -->&#x20;**`Fake Street 123`

**line2**string

Address line 2 (e.g., apartment, suite, unit, or building).

**Example:<!-- -->&#x20;**`null`

**zip**string

ZIP or postal code.

**Example:<!-- -->&#x20;**`1234`

**state**string

State, county, province, or region.

**Example:<!-- -->&#x20;**`Málaga`

**trialPeriodEnd**int64

The end date of the trial period. Measured in seconds since the Unix epoch.

**Example:<!-- -->&#x20;**`1636366897`

**trialPeriodDays**int32

Number of days the trial period lasts.

**Example:<!-- -->&#x20;**`7`

**retrySchedule** <!-- -->object\[]

Defines a custom schedule for retrying failed subscription payments. Each entry in the array specifies how long to wait before attempting the next payment retry. If not specified, the system's default retry schedule will be used.

* Array \[

**interval**stringrequired

The unit of time to wait before the retry attempt.

| Enum Value | Description |
| ---------- | ----------- |
| day        | Daily       |
| week       | Weekly      |
| month      | Monthly     |
| year       | Yearly      |

**Possible values:** \[`day`, `week`, `month`, `year`]

**Example:<!-- -->&#x20;**`day`

**intervalCount**int32required

The number of intervals to wait before the retry attempt.

**Possible values:** `>= 1` and `<= 31`

**Example:<!-- -->&#x20;**`3`

* ]

**callbackUrl**Subscription-CallbackUrl

The URL will be called each time subscription status changes. You will receive a subscription object in the body of the request.

**Example:<!-- -->&#x20;**`https://example.com/subscriptions/callback`

**paymentCallbackUrl**Subscription-PaymentCallbackUrl

The URL will be called each time subscription creates a new payments. You will receive the payment object in the body of the request.

**Example:<!-- -->&#x20;**`https://example.com/payments/callback`

**metadata**object

A set of key-value pairs that you can attach to a resource. This can be useful for storing additional information about the resource in a structured format.

**Example:<!-- -->&#x20;**`{"systemId":"12345"}`

CreateSubscriptionRequest

```
{

  "amount": 110,

  "currency": "EUR",

  "interval": "month",

  "intervalCount": 1,

  "allowedPaymentMethods": [

    "card",

    "bizum"

  ],

  "description": "MoonMail Monthly Lite",

  "customer": {

    "email": "john.doe@example.com",

    "name": "John Doe",

    "phone": null

  },

  "billingDetails": {

    "name": "John Doe",

    "email": "john.doe@example.com",

    "phone": null,

    "company": null,

    "taxId": null,

    "address": {

      "country": "ES",

      "city": "Málaga",

      "line1": "Fake Street 123",

      "line2": null,

      "zip": "1234",

      "state": "Málaga"

    }

  },

  "shippingDetails": {

    "name": "John Doe",

    "email": "john.doe@example.com",

    "phone": null,

    "company": null,

    "taxId": null,

    "address": {

      "country": "ES",

      "city": "Málaga",

      "line1": "Fake Street 123",

      "line2": null,

      "zip": "1234",

      "state": "Málaga"

    }

  },

  "trialPeriodEnd": 1636366897,

  "trialPeriodDays": 7,

  "retrySchedule": [

    {

      "interval": "day",

      "intervalCount": 1

    },

    {

      "interval": "day",

      "intervalCount": 3

    },

    {

      "interval": "week",

      "intervalCount": 1

    }

  ],

  "callbackUrl": "https://example.com/subscriptions/callback",

  "paymentCallbackUrl": "https://example.com/payments/callback",

  "metadata": {

    "systemId": "12345"

  }

}
```
