# Workflows, Payments, Signing & Integrations

## Multi-Step Approval Workflows

Enable `settings.workflow` on any form to route incoming submissions through ordered approval steps:

```json
{
  "workflow": {
    "enabled": true,
    "steps": [
      {
        "id": "step_mgr",
        "name": "Manager Review",
        "order": 1,
        "approverEmail": "manager@company.eu",
        "approverName": "Operations Lead",
        "reminderAfterHours": 24
      },
      {
        "id": "step_cfo",
        "name": "Finance Sign-off",
        "order": 2,
        "approverEmail": "finance@company.eu",
        "condition": { "field": "amount_eur", "operator": "gte", "value": 1000 }
      }
    ],
    "onApproved": { "setStatus": "read", "notifySubmitter": true },
    "onDenied": { "setStatus": "archived", "notifySubmitter": true }
  }
}
```

- Approvers receive a signed 1-click review link at `https://cdn.blokforms.com/approve/:token`.
- Team members can also approve or deny steps in Studio or via `POST /api/v1/approvals/:stepId/decide` (and the `decide_approval_step` MCP tool).
- The hourly EU cron automatically sends overdue reminders and daily/weekly Digest emails (`settings.digest`).

## Live Appointment Slot Booking

Adding an `appointment` field enables:
- Live slot availability lookup: `GET https://cdn.blokforms.com/f/:formId/slots?field=appointment_slot&date=2026-12-10`
- Server-side overbooking protection (HTTP `409 SLOT_UNAVAILABLE` when slot capacity is reached)
- Automatic RFC 5545 calendar invite download: `GET https://cdn.blokforms.com/f/:formId/bookings/:bookingId.ics`
- Emits the `booking.created` event to webhooks and native integrations

## EU Payments (Mollie & Stripe)

1. Connect **Mollie** (iDEAL, Bancontact, SEPA, Klarna) or **Stripe** under **Workspace settings -> Payments** (API keys are AES-256-GCM encrypted at rest).
2. Add a `product_list` or `calculation` field and enable `settings.payments`.
3. Submissions create a checkout session and return `payment.checkoutUrl`; webhooks at `/webhooks/mollie/:paymentId` and `/webhooks/stripe/:orgId` update transaction status and trigger receipt emails.

## PDF Documents & BlokForms Sign

- **PDF Generator (`settings.pdf.enabled: true`):** Generates A4 PDF 1.4 documents with WinAnsi EU character support, VAT order tables, and optional SHA-256 audit certificates stored in private EU storage.
- **BlokForms Sign (`settings.signing.enabled: true`):** Auto-initiates multi-signer envelopes with 6-digit email OTP verification at `https://cdn.blokforms.com/sign/:token` and produces a tamper-evident signed PDF.

## Native Integrations & HMAC Webhooks

Connect encrypted integrations via Studio, `POST /api/v1/integrations`, or `create_form_integration` MCP tool:

| Provider | Required `config` keys |
| --- | --- |
| `slack` | `{ webhookUrl }` |
| `teams` | `{ webhookUrl }` |
| `notion` | `{ apiKey, databaseId, titleProperty? }` |
| `airtable` | `{ apiKey, baseId, tableName }` |
| `hubspot` | `{ apiKey }` |
| `google_sheets` | `{ webhookUrl }` |
| `make_zapier` | `{ webhookUrl }` |

Supported events: `submission.created`, `submission.spam`, `submission.updated`, `payment.paid`, `payment.failed`, `payment.refunded`, `signature.completed`, `signature.declined`, `approval.approved`, `approval.denied`, `booking.created`.
