v1

latestOpenAPI 3.0.02026-08-0631139237.5 KB
Payments

Create Payment

Creates a new payment with the specified parameters.

You can create a payment in two ways:

  1. Immediate processing: Provide a paymentToken or paymentMethod - The payment will be processed instantly
  2. Deferred processing: Create without payment details - The payment remains in PENDING status until you confirm it later using the confirm endpoint

When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction.

For immediate processing, use one of these token options:

  • A temporary paymentToken generated on the frontend using monei.js Components
  • A permanent paymentToken from a previous successful payment (when generatePaymentToken: true was included)

Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information.

post/payments

Request body

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 required

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

callbackUrlstring

The URL to which a payment result should be sent asynchronously.

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

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.

generatePaymentTokenboolean

If set to true a permanent token that represents a payment method used in the payment will be generated.

allowedPaymentMethodsstring[]

An array of allowed payment methods (used in hosted payment page). Must be enabled payment methods.

transactionType'SALE' | 'AUTH' | 'PAYOUT' | 'VERIF'

Controls when the funds will be captured.

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.

subscriptionIdstring

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

autoRecoverboolean

If set to true, the new payment will be automatically created when customer visits the payment link of the previously failed payment. Is automatically set to true if completeUrl is not provided.(set this value to true to create "Pay By Link" payments).

descriptionstring

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

expireAtnumber

Payment expiration time.

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

{
  "amount": 110,
  "currency": "EUR",
  "orderId": "14379133960355",
  "callbackUrl": "https://example.com/checkout/callback",
  "completeUrl": "https://example.com/checkout/complete",
  "failUrl": "https://example.com/checkout/fail",
  "cancelUrl": "https://example.com/checkout/cancel",
  "paymentToken": "7cc38b08ff471ccd313ad62b23b9f362b107560b",
  "sessionId": "39603551437913",
  "paymentMethod": {
    "card": {
      "cardholderName": "John Doe",
      "cardholderEmail": "john.doe@monei.com"
    }
  },
  "allowedPaymentMethods": [
    "card",
    "bizum",
    "paypal"
  ],
  "transactionType": "SALE",
  "sequence": {
    "type": "recurring",
    "recurring": {
      "expiry": "20210630",
      "frequency": 30
    }
  },
  "storeId": "e5f28150d9e8974c58ab5ec9c4a880f8734dcf05",
  "pointOfSaleId": "fb269cccfa0cc021f5d0b8eb1421646c696213e1",
  "subscriptionId": "575bcd84-09fc-4a6e-8c4c-f88b8eb90bfa",
  "description": "Test Shop - #84370745531439",
  "customer": {
    "email": "john.doe@example.com",
    "name": "John Doe"
  },
  "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"
  },
  "expireAt": 1663581391,
  "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
}