Developer resources

Agent Payments

Pay for processing via Stripe.

Stripe payment flow

Four steps, no human in the loop.

  1. Agent submits a job

    Lucidry answers HTTP 402 Payment Required with the payment instructions.

  2. Agent pays via Stripe

    The agent opens an authorization at the returned payment_url and settles the charge.

  3. Agent retries with proof

    The same job request is replayed with the authorization id and payment proof headers.

  4. Lucidry validates and accepts

    A verified payment returns 202 Accepted and the refinery pipeline begins.

402 response

Returned whenever a job needs a payment the caller has not authorized.

json
{
  "status": 402,
  "payment_required": true,
  "payment_methods": ["stripe"],
  "stripe": {
    "payment_url": "https://lucidry.base44.app/functions/authorizePayment",
    "max_amount": 500,
    "currency": "USD"
  }
}

Payment authorization

bash
curl -X POST https://lucidry.base44.app/functions/authorizePayment \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 500, "currency": "USD", "payment_method": "stripe", "job_id": "job_123"}'

Response

json
{
  "authorization_id": "auth_abc123",
  "status": "pending",
  "amount_authorized": 500,
  "currency": "USD",
  "expires_at": "2026-08-30T20:15:00Z",
  "payment_url": "https://lucidry.base44.app/functions/authorizePayment"
}

Retry with payment proof

Replay the original job request with the authorization and proof headers.

bash
curl -X POST https://lucidry.base44.app/functions/v1CreateJob \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Payment-Authorization: auth_abc123" \
  -H "X-Payment-Proof: proof_xyz789" \
  -H "Content-Type: application/json" \
  -d '{"source_asset_id": "src_001", "transform_profile_id": "prof_001"}'

Settlement and receipt

  • A settlement is recorded once the job completes, with the Stripe transaction id.
  • The receipt carries the transaction id and job lineage. Internal ledger figures are never exposed.
  • Reconciliation runs asynchronously between Stripe and the internal ledger.
  • A settlement that disagrees with the provider is flagged as a discrepancy for manual review.
json
{
  "settlement_id": "stl_001",
  "job_id": "job_123",
  "payment_authorization_id": "auth_abc123",
  "amount": 480,
  "currency": "USD",
  "payment_method": "stripe",
  "transaction_id": "ch_stripe_9f21c4",
  "status": "settled",
  "settled_at": "2026-08-30T20:18:00Z"
}

Authorization expiry

  • Payment authorizations expire 5 minutes after they are created.
  • An expired authorization requires a fresh 402, pay, retry cycle.
  • Jobs never start without a valid payment authorization.
  • A failed or unverified payment produces no artifacts.

Budget delegation

Set per-job, per-day and per-month spending limits for each agent.

Budgets are checked before payment authorization, and usage is recorded on the settled amount. See the budget delegation docs.