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

# Stripe REST API

> Deferred client-mode REST API connector for a small Stripe subset (balance, charges, PaymentIntents, customers)

Technical Preview

## Overview

A **deferred, non-priority** client connector for a curated eight-operation slice of the [Stripe API](https://docs.stripe.com/api): balance, charges, PaymentIntents, customers, and products. It is kept as a reference. It is not part of the IIoT or enterprise-system catalog rollout.

> [!NOTE]
>
> Stripe calls need a secret key (`sk_test_…` or `sk_live_…`). A missing or invalid key returns HTTP 401. This template has not been verified with a live key. Prefer PaymentIntents over creating legacy Charges.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Stripe
# Generated from OpenAPI; credentials are placeholders only.
# Docs: https://docs.coreflux.org/latest/lot-language/routes/rest-api-routes

DEFINE ROUTE StripeRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.stripe.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
        # Auth: Stripe secret key as Bearer — pass {value.json.api_token} (sk_test_... / sk_live_...).
        # Prefer Hub secrets / GET SECRET upstream — never commit real keys.
        # Optional Basic (legacy): WITH USERNAME "sk_..." / WITH PASSWORD "" — Bearer header preferred.
    ADD EVENT Getbalance
        WITH SOURCE_TOPIC "integrations/stripe/request/Getbalance"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Getbalance"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/balance"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listcharges
        WITH SOURCE_TOPIC "integrations/stripe/request/Listcharges"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Listcharges"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/charges"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Getcharge
        WITH SOURCE_TOPIC "integrations/stripe/request/Getcharge"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Getcharge"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/charges/{value.json.charge}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Createpaymentintent
        WITH SOURCE_TOPIC "integrations/stripe/request/Createpaymentintent"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Createpaymentintent"
        WITH METHOD "POST"
        WITH ENDPOINT "/v1/payment_intents"
        WITH HEADERS
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Getpaymentintent
        WITH SOURCE_TOPIC "integrations/stripe/request/Getpaymentintent"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Getpaymentintent"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/payment_intents/{value.json.intent}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Createcustomer
        WITH SOURCE_TOPIC "integrations/stripe/request/Createcustomer"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Createcustomer"
        WITH METHOD "POST"
        WITH ENDPOINT "/v1/customers"
        WITH HEADERS
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Getcustomer
        WITH SOURCE_TOPIC "integrations/stripe/request/Getcustomer"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Getcustomer"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/customers/{value.json.customer}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listproducts
        WITH SOURCE_TOPIC "integrations/stripe/request/Listproducts"
        WITH DESTINATION_TOPIC "integrations/stripe/response/Listproducts"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/products"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
```

## Events

| Event | Method | Endpoint | Request topic | Response topic |
| - | - | - | - | - |
| Getbalance | GET | `/v1/balance` | `integrations/stripe/request/Getbalance` | `integrations/stripe/response/Getbalance` |
| Listcharges | GET | `/v1/charges` | `integrations/stripe/request/Listcharges` | `integrations/stripe/response/Listcharges` |
| Getcharge | GET | `/v1/charges/{value.json.charge}` | `integrations/stripe/request/Getcharge` | `integrations/stripe/response/Getcharge` |
| Createpaymentintent | POST | `/v1/payment_intents` | `integrations/stripe/request/Createpaymentintent` | `integrations/stripe/response/Createpaymentintent` |
| Getpaymentintent | GET | `/v1/payment_intents/{value.json.intent}` | `integrations/stripe/request/Getpaymentintent` | `integrations/stripe/response/Getpaymentintent` |
| Createcustomer | POST | `/v1/customers` | `integrations/stripe/request/Createcustomer` | `integrations/stripe/response/Createcustomer` |
| Getcustomer | GET | `/v1/customers/{value.json.customer}` | `integrations/stripe/request/Getcustomer` | `integrations/stripe/response/Getcustomer` |
| Listproducts | GET | `/v1/products` | `integrations/stripe/request/Listproducts` | `integrations/stripe/response/Listproducts` |

## Auth

Bearer secret key:

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ADD "Authorization" "Bearer {value.json.api_token}"
```

**api\_token** `string` *required*

Stripe secret key. Publish it as `api_token` from a Hub secret. Never commit `sk_` keys. Dashboard: Stripe API keys.

Balance smoke payload:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_STRIPE_SECRET_KEY"}
```

Create PaymentIntent (body is `{payload}`). Stripe also accepts form-urlencoded; this template sends `application/json`:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_STRIPE_SECRET_KEY", "amount": 1000, "currency": "eur"}
```

## Try it

1. Add the connector on a lab broker that is allowed to call Stripe.
2. Publish the balance payload to `integrations/stripe/request/Getbalance`.
3. Subscribe to `integrations/stripe/response/Getbalance`.
4. Read a charge or intent by publishing `api_token` plus `charge` or `intent` to the matching request topic.

> [!NOTE]
>
> Probes: `GET /v1/balance` with no key returned HTTP 401, and an invalid `sk_test_` Bearer also returned HTTP 401. `lot_lint` reported no findings on `StripeRestApi`.

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.