Skip to content

← checkout

POST/api/v1/paddle/ensure-customer

Ensure Paddle Customer

Ensure the current user has a Paddle customer. Creates one if missing. Called by the frontend before opening the checkout overlay so we can pass the customer_id to Paddle.js. Decision 7 (founder du 21/09) : l'API refuse aussi une souscription a un palier ferme. Le site annonce le prix qu'il s'aprete a ouvrir ; si ce prix appartient a un palier qui n'est pas dans le drapeau d'ouverture, aucune caisse n'est ouverte : 403 avant tout appel Paddle. Sans price_id le controle est sans effet, pour ne pas casser un client qui ne l'envoie pas.

Authentication

This endpoint requires the X-API-Key header or a valid Clerk JWT. Accepted schemes: HTTPBearer.

See Authentication for details.

Request body

Optional. Format: application/json

Responses

StatusDescriptionSchema
200Successful ResponsePaddleCustomerResponse
422Validation ErrorHTTPValidationError

See the standard error codes documented in the Error codes.

Code samples

Three ready-to-paste implementations. Replace $TRINITY_API_KEY with your API key (generated from the dashboard under Profile → API keys).

cURL

curl -X POST \
  'https://api.trinityinsights.io/api/v1/paddle/ensure-customer' \
  -H 'X-API-Key: $TRINITY_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{}'

Python

import os
import requests

BASE = "https://api.trinityinsights.io"
headers = {
    "X-API-Key": os.environ["TRINITY_API_KEY"],
}

response = requests.post(f"{BASE}/api/v1/paddle/ensure-customer", headers=headers, json={}, timeout=10)
response.raise_for_status()
data = response.json()

JavaScript

const apiKey = process.env.TRINITY_API_KEY;

const response = await fetch(
  "https://api.trinityinsights.io/api/v1/paddle/ensure-customer",
  {
    method: "POST",
    headers: {
      "X-API-Key": apiKey,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({}),
  },
);

if (!response.ok) {
  throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();

Institutional disclaimer

Trinity Insights is an educational and analytical tool. Values returned by this endpoint do not constitute investment advice. Trinity Insights is not a Crypto-Asset Service Provider (CASP) registered under MiCA Regulation (EU) 2023/1114. See the full disclaimer.