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

# How Lynq works

> Understand the Payment Intent, Checkout, and webhook lifecycle before you integrate.

A Lynq integration separates payment creation, payment collection, and order fulfilment. Understanding that separation helps you keep credentials safe and prevents duplicate or premature fulfilment.

## Responsibilities

| Component                | Responsibility                                                                             | Credentials it may hold                           |
| ------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| Your server              | Create and retrieve Payment Intents, verify webhooks, update orders                        | Secret API key, webhook signing secret            |
| Your browser application | Request a checkout session from your server, mount Checkout, show progress to the customer | Publishable key, one Payment Intent client secret |
| Lynq Checkout            | Collect payment details, display enabled methods, handle authentication and redirects      | Managed by Lynq                                   |
| Payment-method owner     | Process Card or Idram payments using the credentials connected in Dashboard                | Managed through the Lynq connection               |

<Warning>
  Never send your secret API key or webhook signing secret to the browser. A publishable key is designed for browser code; a secret key is not.
</Warning>

## Payment sequence

```mermaid theme={null}
sequenceDiagram
  participant Customer
  participant Browser as Merchant browser
  participant Server as Merchant server
  participant Lynq
  participant Provider as Payment provider

  Browser->>Server: Start checkout for order
  Server->>Lynq: Create Payment Intent with secret key
  Lynq-->>Server: Payment Intent + client secret
  Server-->>Browser: Payment Intent ID + client secret
  Browser->>Lynq: Mount Checkout with publishable key
  Customer->>Lynq: Select method and submit payment
  Lynq->>Provider: Process payment
  Provider-->>Lynq: Payment result
  Lynq-->>Browser: Merchant-actionable result
  Lynq->>Server: Signed payment_intent.succeeded webhook
  Server->>Server: Verify, deduplicate, fulfil order
```

## Browser results versus webhooks

The browser result exists to update customer-facing UI. It can tell you to show success, pending, or a payment-method error, but browsers can close, lose connectivity, or be manipulated.

The signed webhook is the authoritative server-to-server confirmation. Fulfil goods, grant access, or mark an order paid only after verifying `payment_intent.succeeded` and processing its event ID exactly once.

## Test and live environments

Test and live mode are isolated. A Payment Intent only works with the publishable key and payment-method connections from its own environment. Test webhook events go only to the test endpoint; live events go only to the live endpoint.

Next, [create API keys](/start/api-keys) or go directly to the [quickstart](/start/quickstart).


## Related topics

- [Payment methods](/payment-methods/overview.md)
- [Checkout SDK](/build/checkout-sdk.md)
- [Build your first test payment](/start/quickstart.md)
- [Accept payments with Lynq](/index.md)
- [Verify webhooks](/build/webhooks.md)
