---
title: "Buy one post-purchase option in one click (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.

# Buy one post-purchase option in one click (Idempotency-Key required)

Path: API de l'orchestrateur de paiement › payments

`POST /v1/payments/{paymentId}/post-purchase`

Answers 201 also for a refusal (status failed). requires_action: redirect the browser to nextAction.url; the 3DS return comes back to returnUrl with payment=<id>&postPurchase=<id>, then read the payment server-side.

## Authentication

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

## Path parameters

- `paymentId` (`post/v1/payments/paymentId/post-purchase.path.paymentId`; string, required)
  - pattern: `^pay_[0-9a-f]{32}$`

## Header parameters

- `Idempotency-Key` (`post/v1/payments/paymentId/post-purchase.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/payments/paymentId/post-purchase.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._

- `postPurchaseToken` (`post/v1/payments/paymentId/post-purchase.postPurchaseToken`; string, required)
  - maxLength: `64` · pattern: `^ppt_[1-9][0-9]{0,8}_[A-Za-z0-9_-]{43}$`
- `step` (`post/v1/payments/paymentId/post-purchase.step`; integer, required)
  - maximum: `5` · minimum: `1`
- `line` (`post/v1/payments/paymentId/post-purchase.line`; object, required)
  - `lineRef` (`post/v1/payments/paymentId/post-purchase.line.lineRef`; string, required)
    - pattern: `^[A-Za-z0-9_.:-]{1,64}$`
  - `kind` (`post/v1/payments/paymentId/post-purchase.line.kind`; string, required)
    - one of `"product"`, `"subscription"`, `"option"`
  - `name` (`post/v1/payments/paymentId/post-purchase.line.name`; string, required)
    - maxLength: `200` · minLength: `1` · pattern: `^[^\p{Cc}]*$`
  - `quantity` (`post/v1/payments/paymentId/post-purchase.line.quantity`; integer, required)
    - maximum: `100` · minimum: `1`
  - `unitPrice` (`post/v1/payments/paymentId/post-purchase.line.unitPrice`; object, required)
    - `amount` (`post/v1/payments/paymentId/post-purchase.line.unitPrice.amount`; integer, required)
      - maximum: `99999999` · minimum: `0`
    - `currency` (`post/v1/payments/paymentId/post-purchase.line.unitPrice.currency`; string, required)
      - one of `"EUR"`
  - `shipPrice` (`post/v1/payments/paymentId/post-purchase.line.shipPrice`; object, required)
    - `amount` (`post/v1/payments/paymentId/post-purchase.line.shipPrice.amount`; integer, required)
      - maximum: `99999999` · minimum: `0`
    - `currency` (`post/v1/payments/paymentId/post-purchase.line.shipPrice.currency`; string, required)
      - one of `"EUR"`
  - `isShippable` (`post/v1/payments/paymentId/post-purchase.line.isShippable`; boolean, required)
  - `offerRef` (`post/v1/payments/paymentId/post-purchase.line.offerRef`; string, required)
    - pattern: `^[A-Za-z0-9_-]{1,32}$`
  - `variantRef` (`post/v1/payments/paymentId/post-purchase.line.variantRef`; string, optional)
    - pattern: `^[A-Za-z0-9_-]{1,32}$`
- `amount` (`post/v1/payments/paymentId/post-purchase.amount`; object, required)
  - `amount` (`post/v1/payments/paymentId/post-purchase.amount.amount`; integer, required)
    - maximum: `99999999` · minimum: `0`
  - `currency` (`post/v1/payments/paymentId/post-purchase.amount.currency`; string, required)
    - one of `"EUR"`
- `returnUrl` (`post/v1/payments/paymentId/post-purchase.returnUrl`; string, required)
  - maxLength: `2048` · minLength: `1`
- `metadata` (`post/v1/payments/paymentId/post-purchase.metadata`; map of string, optional)

## Example request

```json
{
  "postPurchaseToken": "string",
  "step": 1,
  "line": {
    "lineRef": "string",
    "kind": "product",
    "name": "string",
    "quantity": 1,
    "unitPrice": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "shipPrice": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "isShippable": true,
    "offerRef": "string",
    "variantRef": "string"
  },
  "amount": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "returnUrl": "string",
  "metadata": {
    "property1": "string",
    "property2": "string"
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/v1/payments/<paymentId>/post-purchase' \
  --header 'Authorization: <Authorization>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: string' \
  --data '
{
  "postPurchaseToken": "string",
  "step": 1,
  "line": {
    "lineRef": "string",
    "kind": "product",
    "name": "string",
    "quantity": 1,
    "unitPrice": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "shipPrice": {
      "amount": 99999999,
      "currency": "EUR"
    },
    "isShippable": true,
    "offerRef": "string",
    "variantRef": "string"
  },
  "amount": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "returnUrl": "string",
  "metadata": {
    "property1": "string",
    "property2": "string"
  }
}
'
```

### TypeScript

```typescript
const url = '<base-url>/v1/payments/<paymentId>/post-purchase';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Idempotency-Key': 'string',
    Authorization: '<Authorization>'
  },
  body: JSON.stringify({
    postPurchaseToken: 'string',
    step: 1,
    line: {
      lineRef: 'string',
      kind: 'product',
      name: 'string',
      quantity: 1,
      unitPrice: {amount: 99999999, currency: 'EUR'},
      shipPrice: {amount: 99999999, currency: 'EUR'},
      isShippable: true,
      offerRef: 'string',
      variantRef: 'string'
    },
    amount: {amount: 99999999, currency: 'EUR'},
    returnUrl: 'string',
    metadata: {property1: 'string', property2: 'string'}
  })
};

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/payments/<paymentId>/post-purchase"

payload = {
    "postPurchaseToken": "string",
    "step": 1,
    "line": {
        "lineRef": "string",
        "kind": "product",
        "name": "string",
        "quantity": 1,
        "unitPrice": {
            "amount": 99999999,
            "currency": "EUR"
        },
        "shipPrice": {
            "amount": 99999999,
            "currency": "EUR"
        },
        "isShippable": True,
        "offerRef": "string",
        "variantRef": "string"
    },
    "amount": {
        "amount": 99999999,
        "currency": "EUR"
    },
    "returnUrl": "string",
    "metadata": {
        "property1": "string",
        "property2": "string"
    }
}
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
{
  "postPurchaseId": "string",
  "paymentId": "string",
  "step": -9007199254740991,
  "status": "succeeded",
  "statusDetail": "authorizing",
  "nextAction": {
    "type": "redirect",
    "url": "string"
  },
  "amount": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "amountRefunded": {
    "amount": 99999999,
    "currency": "EUR"
  },
  "connectorRefs": {
    "connector": "sandbox",
    "orderId": "string",
    "transactionIds": [
      "string"
    ]
  },
  "failure": {
    "code": "string",
    "category": "soft",
    "retryable": true
  },
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "succeededAt": "2019-08-24T14:15:22Z"
}
```

- `postPurchaseId` (`post/v1/payments/paymentId/post-purchase.response.201.postPurchaseId`; string, required)
- `paymentId` (`post/v1/payments/paymentId/post-purchase.response.201.paymentId`; string, required)
- `step` (`post/v1/payments/paymentId/post-purchase.response.201.step`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`
- `status` (`post/v1/payments/paymentId/post-purchase.response.201.status`; string, required)
  - one of `"succeeded"`, `"requires_action"`, `"processing"`, `"failed"`
- `statusDetail` (`post/v1/payments/paymentId/post-purchase.response.201.statusDetail`; string, required)
  - one of `"authorizing"`, `"requires_action"`, `"verifying"`, `"outcome_unknown"`, `"review_required"`, `"succeeded"`, `"failed"`, `"voided"`
- `nextAction` (`post/v1/payments/paymentId/post-purchase.response.201.nextAction`; any of, required)
  - any of the following:
    - `object`
      - `type` (`post/v1/payments/paymentId/post-purchase.response.201.nextAction.1.type`; string, required)
        - one of `"redirect"`
      - `url` (`post/v1/payments/paymentId/post-purchase.response.201.nextAction.1.url`; string, required)
    - `null`
- `amount` (`post/v1/payments/paymentId/post-purchase.response.201.amount`; object, required)
  - `amount` (`post/v1/payments/paymentId/post-purchase.response.201.amount.amount`; integer, required)
    - maximum: `99999999` · minimum: `0`
  - `currency` (`post/v1/payments/paymentId/post-purchase.response.201.amount.currency`; string, required)
    - one of `"EUR"`
- `amountRefunded` (`post/v1/payments/paymentId/post-purchase.response.201.amountRefunded`; object, required)
  - `amount` (`post/v1/payments/paymentId/post-purchase.response.201.amountRefunded.amount`; integer, required)
    - maximum: `99999999` · minimum: `0`
  - `currency` (`post/v1/payments/paymentId/post-purchase.response.201.amountRefunded.currency`; string, required)
    - one of `"EUR"`
- `connectorRefs` (`post/v1/payments/paymentId/post-purchase.response.201.connectorRefs`; object, required)
  - `connector` (`post/v1/payments/paymentId/post-purchase.response.201.connectorRefs.connector`; string, required)
    - one of `"sandbox"`
  - `orderId` (`post/v1/payments/paymentId/post-purchase.response.201.connectorRefs.orderId`; string, optional)
  - `transactionIds` (`post/v1/payments/paymentId/post-purchase.response.201.connectorRefs.transactionIds`; array of string, optional)
- `metadata` (`post/v1/payments/paymentId/post-purchase.response.201.metadata`; map of string, required)
- `createdAt` (`post/v1/payments/paymentId/post-purchase.response.201.createdAt`; 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))$`
- `updatedAt` (`post/v1/payments/paymentId/post-purchase.response.201.updatedAt`; 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))$`
- `failure` (`post/v1/payments/paymentId/post-purchase.response.201.failure`; object, optional)
  - `code` (`post/v1/payments/paymentId/post-purchase.response.201.failure.code`; string, required)
  - `category` (`post/v1/payments/paymentId/post-purchase.response.201.failure.category`; string, required)
    - one of `"soft"`, `"hard"`, `"technical"`
  - `retryable` (`post/v1/payments/paymentId/post-purchase.response.201.failure.retryable`; boolean, required)
- `succeededAt` (`post/v1/payments/paymentId/post-purchase.response.201.succeededAt`; string, optional)
  - 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))$`

### 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/payments/paymentId/post-purchase.response.default.type`; string, required)
- `title` (`post/v1/payments/paymentId/post-purchase.response.default.title`; string, required)
- `status` (`post/v1/payments/paymentId/post-purchase.response.default.status`; integer, required)
  - maximum: `599` · minimum: `400`
- `code` (`post/v1/payments/paymentId/post-purchase.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/payments/paymentId/post-purchase.response.default.requestId`; string, required)
- `retryable` (`post/v1/payments/paymentId/post-purchase.response.default.retryable`; boolean, required)
- `detail` (`post/v1/payments/paymentId/post-purchase.response.default.detail`; string, optional)
- `errors` (`post/v1/payments/paymentId/post-purchase.response.default.errors`; array of object, optional)
  - `path` (`post/v1/payments/paymentId/post-purchase.response.default.errors.path`; string, required)
  - `code` (`post/v1/payments/paymentId/post-purchase.response.default.errors.code`; string, required)
  - `message` (`post/v1/payments/paymentId/post-purchase.response.default.errors.message`; string, required)


Source: https://docs.recette.maeck.xyz/api/post-v1-payments-payment-id-post-purchase/index.md
