v1

latestOpenAPI 3.0.02026-08-0631139237.5 KB
Subscriptions

Activate Subscription

Activates a subscription by attaching a payment method and initiating the billing cycle.

Activation Process:

  1. This endpoint transitions a PENDING subscription to ACTIVE status
  2. An initial payment is created to validate the payment method:
    • For regular subscriptions: First billing cycle payment is processed immediately
    • For trial subscriptions: A zero-amount payment is created to verify the payment method

Payment Method Updates: If the subscription is already active, this endpoint can be used to update the payment method. The update process creates a zero-amount payment to verify the new payment method works correctly.

Important Notes:

  • Subscription billing begins immediately upon successful activation (unless in trial period)
  • The payment method provided will be used for all future recurring charges
  • Activation failures (due to invalid payment method) will keep the subscription in PENDING status
  • You can specify allowedPaymentMethods to restrict which payment methods (e.g., card, bizum) are accepted for the subscription
post/subscriptions/{id}/activate

Request body

paymentTokenstring

A permanent token represents a payment method used in the payment. Pass generatePaymentToken: true when you creating a payment to generate it. You can pass it as paymentToken parameter to create other payments with the same payment method. This token does not expire, and should only be used server-side.

sessionIdstring

A unique identifier within your system that adds security to the payment process. You need to pass the same session ID as the one used on the frontend to initialize MONEI Component (if you needed to). This is required if a payment token (not permanent) was already generated in the frontend.

addAmountinteger

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).

allowedPaymentMethodsstring[]

List of payment methods allowed for subscriptions.

sequenceIdstring

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.

completeUrlstring

The URL the customer will be directed to after transaction completed (successful or failed - except if failUrl is provided).

failUrlstring

The URL the customer will be directed to after transaction has failed, instead of completeUrl (used in hosted payment page). This allows to provide two different URLs for successful and failed payments.

cancelUrlstring

The URL the customer will be directed to if they decide to cancel payment and return to your website (used in hosted payment page).

metadataMetadata

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 request

{
  "paymentToken": "7cc38b08ff471ccd313ad62b23b9f362b107560b",
  "sessionId": "39603551437913",
  "addAmount": 110,
  "allowedPaymentMethods": [
    "card",
    "bizum"
  ],
  "sequenceId": "62b23b9f3627cc38b08ff471ccd313ad",
  "completeUrl": "https://example.com/checkout/complete",
  "failUrl": "https://example.com/checkout/fail",
  "cancelUrl": "https://example.com/checkout/cancel",
  "metadata": {
    "systemId": "12345"
  }
}

Response

A payment object

idstring required

Unique identifier for the payment.

amountinteger required

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).

currencystring required

Three-letter ISO currency code, in uppercase. Must be a supported currency.

orderIdstring

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

descriptionstring

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

accountIdstring required

MONEI Account identifier.

authorizationCodestring

Unique identifier provided by the bank performing transaction.

livemodeboolean required

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

status'SUCCEEDED' | 'PENDING' | 'FAILED' | 'CANCELED' | 'REFUNDED' | 'PARTIALLY_REFUNDED' | 'AUTHORIZED' | 'EXPIRED' | 'PENDING_PROCESSING' | 'PAID_OUT' required

The status of the payment.

statusCodestring

Payment status code.

statusMessagestring

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

refundedAmountinteger

Amount in cents refunded (can be less than the amount attribute on the payment if a partial refund was issued).

lastRefundAmountinteger

Amount in cents refunded in the last transaction.

lastRefundReason'duplicated' | 'fraudulent' | 'requested_by_customer' | 'order_canceled'

The reason of the last refund transaction.

cancellationReason'duplicated' | 'fraudulent' | 'requested_by_customer' | 'order_canceled'

The reason for canceling the Payment.

paymentTokenstring

A permanent token represents a payment method used in the payment. Pass generatePaymentToken: true when you creating a payment to generate it. You can pass it as paymentToken parameter to create other payments with the same payment method. This token does not expire, and should only be used server-side.

sequenceIdstring

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.

storeIdstring

A unique identifier of the Store. If specified the payment is attached to this Store.

pointOfSaleIdstring

A unique identifier of the Point of Sale. If specified the payment is attached to this Point of Sale. If there is a QR code attached to the same Point of Sale, this payment will be available by scanning the QR code.

metadataMetadata

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.

createdAtinteger

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

updatedAtinteger

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

Example response

{
  "id": "af6029f80f5fc73a8ad2753eea0b1be0",
  "amount": 110,
  "currency": "EUR",
  "orderId": "14379133960355",
  "description": "Test Shop - #84370745531439",
  "accountId": "aa9333ba-82de-400c-9ae7-087b9f8d2242",
  "authorizationCode": "475816",
  "status": "PENDING",
  "statusCode": "E000",
  "statusMessage": "Transaction approved",
  "customer": {
    "email": "john.doe@example.com",
    "name": "John Doe"
  },
  "shop": {
    "name": "Test Shop",
    "country": "ES"
  },
  "billingDetails": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "address": {
      "country": "ES",
      "city": "Málaga",
      "line1": "Fake Street 123",
      "zip": "1234",
      "state": "Málaga"
    }
  },
  "shippingDetails": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "address": {
      "country": "ES",
      "city": "Málaga",
      "line1": "Fake Street 123",
      "zip": "1234",
      "state": "Málaga"
    }
  },
  "sessionDetails": {
    "ip": "100.100.200.100",
    "countryCode": "ES",
    "lang": "es",
    "deviceType": "desktop",
    "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"
  },
  "traceDetails": {
    "ip": "100.100.200.100",
    "countryCode": "ES",
    "lang": "es",
    "deviceType": "desktop",
    "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",
    "userEmail": "user@example.com"
  },
  "paymentToken": "7cc38b08ff471ccd313ad62b23b9f362b107560b",
  "paymentMethod": {
    "method": "card",
    "card": {
      "country": "ES",
      "brand": "visa",
      "type": "credit",
      "threeDSecureVersion": "2.1.0",
      "threeDSecureFlow": "CHALLENGE",
      "expiration": 2048544000,
      "last4": "0004",
      "fingerprint": "7f2afde1566286c5fb126bb7e79bef549755cce6033dc429013c46d1365ff0e9",
      "tokenizationMethod": "applePay",
      "cardholderName": "John Doe",
      "cardholderEmail": "email@example.com"
    },
    "paypal": {
      "orderId": "7XP21983KL5672104",
      "payerId": "QWRTNBFHZXLPD",
      "email": "john.doe@example.com",
      "name": "John Doe"
    },
    "sepa": {
      "fingerprint": "7f2afde1566286c5fb126bb7e79bef549755cce6033dc429013c46d1365ff0e9"
    },
    "klarna": {
      "billingCategory": "PAY_LATER",
      "authPaymentMethod": "card"
    }
  },
  "sequence": {
    "type": "recurring",
    "recurring": {
      "expiry": "20210630",
      "frequency": 30
    }
  },
  "sequenceId": "62b23b9f3627cc38b08ff471ccd313ad",
  "storeId": "e5f28150d9e8974c58ab5ec9c4a880f8734dcf05",
  "pointOfSaleId": "fb269cccfa0cc021f5d0b8eb1421646c696213e1",
  "metadata": {
    "systemId": "12345"
  },
  "nextAction": {
    "type": "CONFIRM",
    "redirectUrl": "https://secure.monei.com/payments/af6029f80f5fc73a8ad2753eea0b1be0"
  },
  "createdAt": 1636366897,
  "updatedAt": 1636366897
}