# Subscription

**id**Subscription-Idrequired

Unique identifier for the subscription.

**Example:<!-- -->&#x20;**`575bcd84-09fc-4a6e-8c4c-f88b8eb90bfa`

**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-Currency

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

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

**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`

**accountId**AccountIdrequired

MONEI Account identifier.

**Example:<!-- -->&#x20;**`aa9333ba-82de-400c-9ae7-087b9f8d2242`

**livemode**Livemoderequired

Has the value `true` if the resource exists in live mode or the value `false` if the resource exists in test mode.

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

**status**Subscription-Statusrequired

The status of the subscription.

| Enum Value | Description                                                                                        |
| ---------- | -------------------------------------------------------------------------------------------------- |
| PENDING    | The subscription has been created but is waiting for initial payment or activation                 |
| EXPIRED    | The subscription has reached its end date or maximum number of attempts without successful payment |
| TRIALING   | The subscription is in trial period before the first payment is required                           |
| ACTIVE     | The subscription is currently active and payments are being processed normally                     |
| PAST\_DUE  | The most recent payment attempt failed but the subscription will retry according to schedule       |
| PAUSED     | The subscription is temporarily suspended and will resume based on pause settings                  |
| CANCELED   | The subscription has been permanently terminated and will not process further payments             |

**Possible values:** \[`PENDING`, `EXPIRED`, `TRIALING`, `ACTIVE`, `PAST_DUE`, `PAUSED`, `CANCELED`]

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

**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`

**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**int32required

Number of intervals between subscription payments.

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

**pauseIntervalCount**int32

Number of intervals when subscription will be paused before it activates again.

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

**skipIntervalCount**int32

The number of intervals during which the subscription billing cycle will be skipped without altering the subscription status. This is useful when payment for a specific period is received through different methods.

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

**lastOrderId**Payment-OrderId

An order ID from your system. A unique identifier that can be used to reconcile the payment with your internal system.

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

**lastPayment** <!-- -->object

**id**Payment-Id

Unique identifier for the payment.

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

**status**Payment-Status

The status of the payment.

| Enum Value          | Description                                                                   |
| ------------------- | ----------------------------------------------------------------------------- |
| SUCCEEDED           | The payment has been successfully processed and funds have been captured      |
| PENDING             | The payment is being processed and awaiting completion                        |
| FAILED              | The payment attempt was unsuccessful                                          |
| CANCELED            | The payment was canceled before completion                                    |
| REFUNDED            | The full payment amount has been refunded                                     |
| PARTIALLY\_REFUNDED | Only a portion of the payment amount has been refunded                        |
| AUTHORIZED          | The payment has been authorized but funds have not been captured yet          |
| EXPIRED             | The payment has expired without being completed                               |
| PENDING\_PROCESSING | The payment was submitted to the processor and is awaiting an acknowledgement |
| PAID\_OUT           | Funds for this payment have been settled to the merchant's bank account       |

**Possible values:** \[`SUCCEEDED`, `PENDING`, `FAILED`, `CANCELED`, `REFUNDED`, `PARTIALLY_REFUNDED`, `AUTHORIZED`, `EXPIRED`, `PENDING_PROCESSING`, `PAID_OUT`]

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

**statusCode**Payment-StatusCode

Payment status code.

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

**statusMessage**Payment-StatusMessage

Human readable status message, can be displayed to a user.

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

**paymentMethod** <!-- -->object

Details about the payment method at the time of the transaction.

**method**string

Subscription method type.

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

**Possible values:** \[`card`, `bizum`]

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

**card** <!-- -->object

Details about the card used as payment method at the time of the transaction.

**country**Country

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

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

**brand**string

Card brand.

| Enum Value | Description                        |
| ---------- | ---------------------------------- |
| visa       | Visa credit or debit card          |
| mastercard | Mastercard credit or debit card    |
| diners     | Diners Club credit card            |
| amex       | American Express credit card       |
| jcb        | Japan Credit Bureau card           |
| unionpay   | UnionPay card from China           |
| discover   | Discover                           |
| unknown    | Card brand could not be determined |

**Possible values:** \[`visa`, `mastercard`, `diners`, `amex`, `jcb`, `unionpay`, `discover`, `unknown`]

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

**type**string

Card type `debit` or `credit`.

**Possible values:** \[`debit`, `credit`]

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

**threeDSecure**boolean

Whether this transaction used 3D Secure authentication.

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

**threeDSecureVersion**string

The protocol version of the 3DS challenge.

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

**threeDSecureFlow**string

The flow used for 3DS authentication.

| Enum Value              | Description                                                                                           |
| ----------------------- | ----------------------------------------------------------------------------------------------------- |
| CHALLENGE               | Authentication requiring additional shopper interaction through biometrics, 2FA, or other SCA methods |
| FRICTIONLESS            | Background authentication using device fingerprint without additional shopper interaction             |
| FRICTIONLESS\_CHALLENGE | Complete 3DS flow with additional authentication if initial data collection is insufficient           |
| DIRECT                  | Transaction exempt from SCA due to low risk assessment                                                |

**Possible values:** \[`CHALLENGE`, `FRICTIONLESS`, `FRICTIONLESS_CHALLENGE`, `DIRECT`]

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

**expiration**int64

Time at which the card will expire. Measured in seconds since the Unix epoch.

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

**last4**string

The last four digits of the card.

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

**fingerprint**string

Unique identifier for the card number. Used to detect duplicate payment methods across customers. Not present for tokenized cards.

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

**tokenizationMethod**string

The digital wallet used to tokenize the card.

**Possible values:** \[`applePay`, `googlePay`, `clickToPay`]

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

**cardholderName**string

The name of the cardholder.

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

**cardholderEmail**string

The email of the cardholder.

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

**bizum** <!-- -->object

Details about the Bizum account used as payment method at the time of the transaction.

**phoneNumber**string

Phone number in E.164 format used to pay with `bizum`.

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

**currentPeriodStart**int64

The start date of the current subscription period. Measured in seconds since the Unix epoch.

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

**currentPeriodEnd**int64

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

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

**trialPeriodEnd**int64

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

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

**nextPaymentAt**int64

The date when the next payment will be made.

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

**retryCount**int32

Number of retries left for the subscription.

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

**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`

* ]

**cancelAtPeriodEnd**Subscription-CancelAtPeriodEnd

If true, the subscription will be canceled at the end of the current period.

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

**pauseAtPeriodEnd**Subscription-PauseAtPeriodEnd

If true, the subscription will be paused at the end of the current period.

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

**traceDetails** <!-- -->Payment-TraceDetails

Information related to the browsing session of the user who initiated the payment.

**ip**IP

The IP address where the operation originated.

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

**countryCode**Country

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

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

**lang**Lang

Two-letter language code ([ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1)).

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

**deviceType**DeviceType

Device type, could be `desktop`, `mobile`, `smartTV`, `tablet`.

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

**deviceModel**DeviceModel

Information about the device used for the browser session (e.g., `iPhone`).

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

**browser**Browser

The browser used in this browser session (e.g., `Mobile Safari`).

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

**browserVersion**BrowserVersion

The version for the browser session (e.g., `13.1.1`).

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

**os**Os

Operation system (e.g., `iOS`).

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

**osVersion**OsVersion

Operation system version (e.g., `13.5.1`).

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

**source**Source

The source component from where the operation was generated (mostly for our SDK's).

**Example:<!-- -->&#x20;**`MONEI/PHP`

**sourceVersion**SourceVersion

The source component version from where the operation was generated (mostly for our SDK's).

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

**userAgent**UserAgent

Full user agent string of the browser session.

**Example:<!-- -->&#x20;**`Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...`

**browserAccept**BrowserAccept

Browser accept header.

**Example:<!-- -->&#x20;**`text/html,application/xhtml+xml,application/json`

**browserColorDepth**BrowserColorDepth

The color depth of the browser session (e.g., `24`).

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

**browserScreenHeight**BrowserScreenHeight

The screen height of the browser session (e.g., `1152`).

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

**browserScreenWidth**BrowserScreenWidth

The screen width of the browser session (e.g., `2048`).

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

**browserTimezoneOffset**BrowserTimezoneOffset

The timezone offset of the browser session (e.g., `-120`).

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

**userId**string

The ID of the user that started the operation.

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

**userEmail**string

The email of the user that started the operation.

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

**sequenceId**Payment-SequenceId

A permanent identifier that refers to the initial payment of a sequence of payments. This value needs to be sent in the path for `RECURRING` payments.

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

**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"}`

**createdAt**int64

Time at which the resource was created. Measured in seconds since the Unix epoch.

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

**updatedAt**int64

Time at which the resource updated last time. Measured in seconds since the Unix epoch.

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

Subscription

```
{

  "id": "575bcd84-09fc-4a6e-8c4c-f88b8eb90bfa",

  "amount": 110,

  "currency": "EUR",

  "allowedPaymentMethods": [

    "card",

    "bizum"

  ],

  "description": "MoonMail Monthly Lite",

  "accountId": "aa9333ba-82de-400c-9ae7-087b9f8d2242",

  "livemode": false,

  "status": "PENDING",

  "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"

    }

  },

  "interval": "month",

  "intervalCount": 1,

  "pauseIntervalCount": 1,

  "skipIntervalCount": 1,

  "lastOrderId": "14379133960355",

  "lastPayment": {

    "id": "af6029f80f5fc73a8ad2753eea0b1be0",

    "status": "PENDING",

    "statusCode": "E000",

    "statusMessage": "Transaction approved"

  },

  "paymentMethod": {

    "method": "card",

    "card": {

      "country": "ES",

      "brand": "visa",

      "type": "credit",

      "threeDSecure": false,

      "threeDSecureVersion": "2.1.0",

      "threeDSecureFlow": "CHALLENGE",

      "expiration": 2048544000,

      "last4": "0004",

      "fingerprint": "7f2afde1566286c5fb126bb7e79bef549755cce6033dc429013c46d1365ff0e9",

      "tokenizationMethod": "applePay",

      "cardholderName": "John Doe",

      "cardholderEmail": "email@example.com"

    },

    "bizum": {

      "phoneNumber": null

    }

  },

  "currentPeriodStart": 1636366897,

  "currentPeriodEnd": 1636366897,

  "trialPeriodEnd": 1636366897,

  "nextPaymentAt": 1636366897,

  "retryCount": 1,

  "retrySchedule": [

    {

      "interval": "day",

      "intervalCount": 1

    },

    {

      "interval": "day",

      "intervalCount": 3

    },

    {

      "interval": "week",

      "intervalCount": 1

    }

  ],

  "cancelAtPeriodEnd": false,

  "pauseAtPeriodEnd": false,

  "traceDetails": {

    "ip": "100.100.200.100",

    "countryCode": "ES",

    "lang": "es",

    "deviceType": "desktop",

    "deviceModel": null,

    "browser": "Chrome",

    "browserVersion": "83.0.4103.116",

    "os": "Mac OS",

    "osVersion": "10.15.4",

    "source": "MONEI/PHP",

    "sourceVersion": "0.1.2",

    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...",

    "browserAccept": "text/html,application/xhtml+xml,application/json",

    "browserColorDepth": "24",

    "browserScreenHeight": "1152",

    "browserScreenWidth": "2048",

    "browserTimezoneOffset": "-120",

    "userId": null,

    "userEmail": "user@example.com"

  },

  "sequenceId": "62b23b9f3627cc38b08ff471ccd313ad",

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

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

  "metadata": {

    "systemId": "12345"

  },

  "createdAt": 1636366897,

  "updatedAt": 1636366897

}
```
