---
title: "Create a payment session (hosted fields context; Idempotency-Key required)"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.recette.maeck.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a payment session (hosted fields context; Idempotency-Key required)

Path: API de l'orchestrateur de paiement › payment-sessions

`POST /v1/payment-sessions`

parentOrigin must be a verified checkout origin of the site. testMode false requires a live key and live payments open for the platform and the tenant (LIVE_MODE_DISABLED, TEST_KEY_LIVE_REQUEST). An amount in a currency other than EUR: 422 UNSUPPORTED_CURRENCY. The clientSecret is never stored: a replay derives it again.

## Authentication

- `cmsHmac`, apiKey, in header, header `Authorization`

## Header parameters

- `Idempotency-Key` (`post/v1/payment-sessions.header.Idempotency-Key`; string, required) — Mandatory on every POST. Same key and same request: the stored answer is replayed (Idempotent-Replayed: true); another request: IDEMPOTENCY_KEY_REUSED; still running: IDEMPOTENCY_IN_PROGRESS (409, Retry-After).
  - pattern: `^(?!alert:|external:)[A-Za-z0-9_.:-]{8,255}$`
- `Api-Version` (`post/v1/payment-sessions.header.Api-Version`; string, optional) — Version of the API: absent, the current version answers; an unknown value is refused (API_VERSION_UNSUPPORTED, 400). Every other answer gives the version that produced it.
  - one of `"2026-11-18"` · default: `"2026-11-18"`

## Request body

_Required._

- `siteRef` (`post/v1/payment-sessions.siteRef`; string, required)
  - pattern: `^[A-Za-z0-9_.:-]{1,64}$`
- `parentOrigin` (`post/v1/payment-sessions.parentOrigin`; string, required)
  - maxLength: `255` · minLength: `1`
- `locale` (`post/v1/payment-sessions.locale`; string, required)
  - pattern: `^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8}){0,3}$`
- `testMode` (`post/v1/payment-sessions.testMode`; boolean, required)
- `campaignRef` (`post/v1/payment-sessions.campaignRef`; string, optional)
  - pattern: `^[A-Za-z0-9_-]{1,32}$`
- `orderRef` (`post/v1/payment-sessions.orderRef`; string, optional)
  - pattern: `^[A-Za-z0-9][A-Za-z0-9._:/#-]{0,63}$`
- `amount` (`post/v1/payment-sessions.amount`; object, optional)
  - `amount` (`post/v1/payment-sessions.amount.amount`; integer, required)
    - maximum: `99999999` · minimum: `0`
  - `currency` (`post/v1/payment-sessions.amount.currency`; string, required)
    - one of `"EUR"`
- `country` (`post/v1/payment-sessions.country`; string, optional)
  - pattern: `^[A-Z]{2}$`
- `ttlSeconds` (`post/v1/payment-sessions.ttlSeconds`; integer, optional)
  - maximum: `3600` · minimum: `300`
- `metadata` (`post/v1/payment-sessions.metadata`; map of string, optional)
- `wallet` (`post/v1/payment-sessions.wallet`; object, optional)
  - `amount` (`post/v1/payment-sessions.wallet.amount`; object, required)
    - `amount` (`post/v1/payment-sessions.wallet.amount.amount`; integer, required)
      - maximum: `99999999` · minimum: `0`
    - `currency` (`post/v1/payment-sessions.wallet.amount.currency`; string, required)
      - one of `"EUR"`
  - `recurring` (`post/v1/payment-sessions.wallet.recurring`; object, optional)
    - `description` (`post/v1/payment-sessions.wallet.recurring.description`; string, required)
      - maxLength: `100` · minLength: `1` · pattern: `^[^\p{Cc}\p{Cs}]+$`
    - `regular` (`post/v1/payment-sessions.wallet.recurring.regular`; object, required)
      - `amount` (`post/v1/payment-sessions.wallet.recurring.regular.amount`; object, required)
        - `amount` (`post/v1/payment-sessions.wallet.recurring.regular.amount.amount`; integer, required)
          - maximum: `99999999` · minimum: `0`
        - `currency` (`post/v1/payment-sessions.wallet.recurring.regular.amount.currency`; string, required)
          - one of `"EUR"`
      - `interval` (`post/v1/payment-sessions.wallet.recurring.regular.interval`; string, required)
        - one of `"day"`, `"week"`, `"month"`, `"year"`
      - `intervalCount` (`post/v1/payment-sessions.wallet.recurring.regular.intervalCount`; integer, required)
        - maximum: `365` · minimum: `1`
    - `managementUrl` (`post/v1/payment-sessions.wallet.recurring.managementUrl`; string, required)
      - maxLength: `255` · pattern: `^https:\/\/[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\d{1,5})?(?:\/[A-Za-z0-9._~-]+)*$`
    - `offerRef` (`post/v1/payment-sessions.wallet.recurring.offerRef`; string, optional)
      - pattern: `^[A-Za-z0-9_-]{1,32}$`
    - `trial` (`post/v1/payment-sessions.wallet.recurring.trial`; object, optional)
      - `amount` (`post/v1/payment-sessions.wallet.recurring.trial.amount`; object, required)
        - `amount` (`post/v1/payment-sessions.wallet.recurring.trial.amount.amount`; integer, required)
          - maximum: `99999999` · minimum: `0`
        - `currency` (`post/v1/payment-sessions.wallet.recurring.trial.amount.currency`; string, required)
          - one of `"EUR"`
      - `interval` (`post/v1/payment-sessions.wallet.recurring.trial.interval`; string, required)
        - one of `"day"`, `"week"`, `"month"`, `"year"`
      - `intervalCount` (`post/v1/payment-sessions.wallet.recurring.trial.intervalCount`; integer, required)
        - maximum: `365` · minimum: `1`
    - `billingAgreement` (`post/v1/payment-sessions.wallet.recurring.billingAgreement`; string, optional)
      - maxLength: `300` · minLength: `1` · pattern: `^[^\p{Cc}\p{Cs}]+$`
- `cardEntry` (`post/v1/payment-sessions.cardEntry`; string, optional)
  - one of `"frame"`, `"page"`, `"server"` · default: `"frame"`

## Example request

```json
{
  "siteRef": "string",
  "campaignRef": "string",
  "parentOrigin": "string",
  "orderRef": "string",
  "locale": "string",
  "amount": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "country": "string",
  "testMode": true,
  "ttlSeconds": 300,
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "wallet": {
    "amount": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "recurring": {
      "description": "string",
      "offerRef": "string",
      "regular": {
        "amount": {
          "amount": 99999999,
          "currency": "EUR"
        },
        "interval": "day",
        "intervalCount": 1
      },
      "trial": {
        "amount": {
          "amount": 99999999,
          "currency": "EUR"
        },
        "interval": "day",
        "intervalCount": 1
      },
      "managementUrl": "string",
      "billingAgreement": "string"
    }
  },
  "cardEntry": "frame"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/v1/payment-sessions' \
  --header 'Authorization: <Authorization>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: string' \
  --data '
{
  "siteRef": "string",
  "campaignRef": "string",
  "parentOrigin": "string",
  "orderRef": "string",
  "locale": "string",
  "amount": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "country": "string",
  "testMode": true,
  "ttlSeconds": 300,
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "wallet": {
    "amount": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "recurring": {
      "description": "string",
      "offerRef": "string",
      "regular": {
        "amount": {
          "amount": 99999999,
          "currency": "EUR"
        },
        "interval": "day",
        "intervalCount": 1
      },
      "trial": {
        "amount": {
          "amount": 99999999,
          "currency": "EUR"
        },
        "interval": "day",
        "intervalCount": 1
      },
      "managementUrl": "string",
      "billingAgreement": "string"
    }
  },
  "cardEntry": "frame"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/v1/payment-sessions';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Idempotency-Key': 'string',
    Authorization: '<Authorization>'
  },
  body: JSON.stringify({
    siteRef: 'string',
    campaignRef: 'string',
    parentOrigin: 'string',
    orderRef: 'string',
    locale: 'string',
    amount: {amount: 99999999, currency: 'EUR'},
    country: 'string',
    testMode: true,
    ttlSeconds: 300,
    metadata: {property1: 'string', property2: 'string'},
    wallet: {
      amount: {amount: 99999999, currency: 'EUR'},
      recurring: {
        description: 'string',
        offerRef: 'string',
        regular: {amount: {amount: 99999999, currency: 'EUR'}, interval: 'day', intervalCount: 1},
        trial: {amount: {amount: 99999999, currency: 'EUR'}, interval: 'day', intervalCount: 1},
        managementUrl: 'string',
        billingAgreement: 'string'
      }
    },
    cardEntry: 'frame'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/v1/payment-sessions"

payload = {
    "siteRef": "string",
    "campaignRef": "string",
    "parentOrigin": "string",
    "orderRef": "string",
    "locale": "string",
    "amount": {
        "amount": 99999999,
        "currency": "EUR"
    },
    "country": "string",
    "testMode": True,
    "ttlSeconds": 300,
    "metadata": {
        "property1": "string",
        "property2": "string"
    },
    "wallet": {
        "amount": {
            "amount": 99999999,
            "currency": "EUR"
        },
        "recurring": {
            "description": "string",
            "offerRef": "string",
            "regular": {
                "amount": {
                    "amount": 99999999,
                    "currency": "EUR"
                },
                "interval": "day",
                "intervalCount": 1
            },
            "trial": {
                "amount": {
                    "amount": 99999999,
                    "currency": "EUR"
                },
                "interval": "day",
                "intervalCount": 1
            },
            "managementUrl": "string",
            "billingAgreement": "string"
        }
    },
    "cardEntry": "frame"
}
headers = {
    "Content-Type": "application/json",
    "Idempotency-Key": "string",
    "Authorization": "<Authorization>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Default Response

#### Example

```json
{
  "id": "string",
  "clientSecret": "string",
  "expiresAt": "2019-08-24T14:15:22Z",
  "fields": {
    "scriptUrl": "string",
    "integrity": "string",
    "frameOrigin": "string",
    "walletOrigin": "string",
    "page": {
      "scriptUrl": "string",
      "integrity": "string"
    }
  },
  "riskMode": "normal",
  "acceptedBrands": [
    "visa"
  ],
  "checkout": {
    "locale": "fr",
    "methods": [
      "card"
    ],
    "billingAddress": "none",
    "appearance": {
      "textColor": null,
      "backgroundColor": null,
      "borderColor": null,
      "focusColor": null,
      "errorColor": null,
      "placeholderColor": null,
      "borderRadius": null,
      "fontSize": null,
      "fontFamily": null
    }
  }
}
```

- `id` (`post/v1/payment-sessions.response.201.id`; string, required)
- `clientSecret` (`post/v1/payment-sessions.response.201.clientSecret`; string, required)
- `expiresAt` (`post/v1/payment-sessions.response.201.expiresAt`; string, required)
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
- `fields` (`post/v1/payment-sessions.response.201.fields`; object, required)
  - `scriptUrl` (`post/v1/payment-sessions.response.201.fields.scriptUrl`; string, required)
  - `integrity` (`post/v1/payment-sessions.response.201.fields.integrity`; string, required)
  - `frameOrigin` (`post/v1/payment-sessions.response.201.fields.frameOrigin`; string, required)
  - `walletOrigin` (`post/v1/payment-sessions.response.201.fields.walletOrigin`; string, optional)
  - `page` (`post/v1/payment-sessions.response.201.fields.page`; object, optional)
    - `scriptUrl` (`post/v1/payment-sessions.response.201.fields.page.scriptUrl`; string, required)
    - `integrity` (`post/v1/payment-sessions.response.201.fields.page.integrity`; string, required)
- `riskMode` (`post/v1/payment-sessions.response.201.riskMode`; string, required)
  - one of `"normal"`, `"card_testing"`
- `acceptedBrands` (`post/v1/payment-sessions.response.201.acceptedBrands`; array of string, required)
  - one of `"visa"`, `"mastercard"`, `"cb"`, `"amex"`, `"maestro"`
- `checkout` (`post/v1/payment-sessions.response.201.checkout`; object, required)
  - `locale` (`post/v1/payment-sessions.response.201.checkout.locale`; string, required)
    - one of `"fr"`, `"en"`, `"de"`, `"es"`, `"it"`, `"nl"`, `"pt"`
  - `methods` (`post/v1/payment-sessions.response.201.checkout.methods`; array of string, required)
    - one of `"card"`, `"apple_pay"`, `"google_pay"`
  - `billingAddress` (`post/v1/payment-sessions.response.201.checkout.billingAddress`; string, required)
    - one of `"none"`, `"postal_code"`, `"full"`
  - `appearance` (`post/v1/payment-sessions.response.201.checkout.appearance`; object, required)
    - `textColor` (`post/v1/payment-sessions.response.201.checkout.appearance.textColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `backgroundColor` (`post/v1/payment-sessions.response.201.checkout.appearance.backgroundColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `borderColor` (`post/v1/payment-sessions.response.201.checkout.appearance.borderColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `focusColor` (`post/v1/payment-sessions.response.201.checkout.appearance.focusColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `errorColor` (`post/v1/payment-sessions.response.201.checkout.appearance.errorColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `placeholderColor` (`post/v1/payment-sessions.response.201.checkout.appearance.placeholderColor`; any of, required)
      - default: `null`
      - any of the following: `string`, `null`
    - `borderRadius` (`post/v1/payment-sessions.response.201.checkout.appearance.borderRadius`; any of, required)
      - default: `null`
      - any of the following: `integer`, `null`
    - `fontSize` (`post/v1/payment-sessions.response.201.checkout.appearance.fontSize`; any of, required)
      - default: `null`
      - any of the following: `integer`, `null`
    - `fontFamily` (`post/v1/payment-sessions.response.201.checkout.appearance.fontFamily`; any of, required)
      - default: `null`
      - any of the following:
        - `string`: one of `"system-ui"`, `"sans-serif"`, `"serif"`, `"Arial"`, `"Helvetica"`, `"Verdana"`, `"Georgia"`
        - `null`

### default

Problem: the stable code is in code, see x-error-catalog.

#### Example

```json
{
  "type": "string",
  "title": "string",
  "status": 400,
  "code": "AMOUNT_LIMIT_EXCEEDED",
  "detail": "string",
  "requestId": "string",
  "retryable": true,
  "errors": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `type` (`post/v1/payment-sessions.response.default.type`; string, required)
- `title` (`post/v1/payment-sessions.response.default.title`; string, required)
- `status` (`post/v1/payment-sessions.response.default.status`; integer, required)
  - maximum: `599` · minimum: `400`
- `code` (`post/v1/payment-sessions.response.default.code`; string, required)
  - one of `"AMOUNT_LIMIT_EXCEEDED"`, `"AMOUNT_MISMATCH"`, `"API_VERSION_UNSUPPORTED"`, `"AUTH_IP_NOT_ALLOWED"`, `"AUTH_KEY_INVALID"`, `"AUTH_MALFORMED"`, `"AUTH_NONCE_REPLAYED"`, `"AUTH_SCOPE_FORBIDDEN"`, `"AUTH_SIGNATURE_INVALID"`, `"AUTH_TIMESTAMP_OUT_OF_WINDOW"`, `"BAD_REQUEST"`, `"CAMPAIGN_MISMATCH"`, `"CARD_BRAND_UNSUPPORTED"`, `"CARD_CVC_INVALID"`, `"CARD_EXPIRED"`, `"CARD_EXPIRY_INVALID"`, `"CARD_HOLDER_INVALID"`, `"CARD_NOT_ACCEPTED"`, `"CARD_NUMBER_INVALID"`, `"CARD_REF_INVALID"`, `"CARD_REF_USED"`, `"CARD_TOKEN_REVOKED"`, `"CARD_VERIFICATION_NOT_AVAILABLE"`, `"CONFLICT"`, `"CONNECTOR_ACCOUNT_MISMATCH"`, `"CONNECTOR_AUTH_FAILED"`, `"CONNECTOR_CAPABILITY_MISSING"`, `"CONNECTOR_DISABLED"`, `"CONNECTOR_ERROR"`, `"CONNECTOR_UNAVAILABLE"`, `"CUSTOMER_DATA_REQUIRED"`, `"IDEMPOTENCY_IN_PROGRESS"`, `"IDEMPOTENCY_KEY_INVALID"`, `"IDEMPOTENCY_KEY_MISSING"`, `"IDEMPOTENCY_KEY_REUSED"`, `"INTERNAL_ERROR"`, `"LIVE_MODE_DISABLED"`, `"METHOD_NOT_ALLOWED"`, `"MID_PAUSED"`, `"MID_TRANSFER_NOT_POSSIBLE"`, `"NOT_FOUND"`, `"ORIGIN_NOT_ALLOWED"`, `"PAGE_CARD_ENTRY_DISABLED"`, `"PAYLOAD_TOO_LARGE"`, `"PAYMENT_INVALID_STATE"`, `"PAYMENT_IN_PROGRESS"`, `"PAYMENT_METHOD_NOT_ALLOWED"`, `"POST_PURCHASE_LIMIT_REACHED"`, `"POST_PURCHASE_STEP_DONE"`, `"POST_PURCHASE_TOKEN_INVALID"`, `"POST_PURCHASE_WINDOW_CLOSED"`, `"PROCESSOR_NOT_ENABLED"`, `"RATE_LIMITED"`, `"REFUND_EXCEEDS_CAPTURED"`, `"REFUND_NOT_SUPPORTED"`, `"RENEWAL_ALREADY_PAID"`, `"RENEWAL_RETRY_NOT_ALLOWED"`, `"RENEWAL_RETRY_TOO_EARLY"`, `"REQUEST_ORIGIN_FORBIDDEN"`, `"RISK_VELOCITY_LIMIT"`, `"SANDBOX_ONLY"`, `"SERVER_CARD_ENTRY_DISABLED"`, `"SERVICE_UNAVAILABLE"`, `"SESSION_EXPIRED"`, `"SESSION_INVALID_STATE"`, `"SESSION_LIMIT_REACHED"`, `"SESSION_SECRET_INVALID"`, `"SITE_DISABLED"`, `"SITE_UNKNOWN"`, `"TEST_CARD_REQUIRED"`, `"TEST_KEY_LIVE_REQUEST"`, `"UNSUPPORTED_CURRENCY"`, `"UNSUPPORTED_MEDIA_TYPE"`, `"VALIDATION_FAILED"`, `"VOID_NOT_SUPPORTED"`, `"WALLET_AMOUNT_MISMATCH"`, `"WALLET_MERCHANT_VALIDATION_FAILED"`, `"WALLET_NOT_AVAILABLE"`, `"WALLET_TOKEN_INVALID"`, `"WEBHOOK_URL_NOT_ALLOWED"`, `"ZERO_AMOUNT_REQUIRES_AUTHORIZE_ONLY"`
- `requestId` (`post/v1/payment-sessions.response.default.requestId`; string, required)
- `retryable` (`post/v1/payment-sessions.response.default.retryable`; boolean, required)
- `detail` (`post/v1/payment-sessions.response.default.detail`; string, optional)
- `errors` (`post/v1/payment-sessions.response.default.errors`; array of object, optional)
  - `path` (`post/v1/payment-sessions.response.default.errors.path`; string, required)
  - `code` (`post/v1/payment-sessions.response.default.errors.code`; string, required)
  - `message` (`post/v1/payment-sessions.response.default.errors.message`; string, required)


Source: https://docs.recette.maeck.xyz/api/payment-sessions/create/index.md
