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

# External Payment Link

> Jane scans a QR code or opens a signed payment link from a creditor message.

## Real-World Example

Jane scans a QR code or opens a signed payment link from a creditor message. The portal should take her directly to the intended payment context while still protecting the link from tampering or misuse.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Consumer opens signed payment link or QR code"] --> B["Portal validates signature"]
    B --> C{"Link valid and account allowed?"}
    C -->|Yes| D["Portal opens external payment flow"]
    C -->|No| E["Portal blocks access"]
    D --> F["Payment can continue for intended account"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,D,F system;
    class C decision;
    class E risk;
    class F outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should validate signed external payment links before showing payment details.
* It should route the consumer to the intended account and payment context.
* It should support QR-code entry points without bypassing account safety.

## How It Should Not Work

* It should not accept expired, modified, or unsigned payment links.
* It should not expose full portal access to a link viewer unless normal authentication allows it.
* It should not let one signed link pay a different account.

## Developer Notes

* External payment and QR flows are public/signed routes.
* Call `GET /payment` with the complete signed query string to load payer-facing data.
* Submit the payment to `POST /payment` using the same signed query string and a unique `Idempotency-Key` header.
* Tokenize card or bank details with Basis Theory. Raw payment credentials must never pass through the frontend application server or the YouNegotiate payment API.
* Use the returned signed `status_url` and `receipt.download_url` as-is. Both are temporary links and must not be reconstructed by the frontend.
* A successful gateway charge remains successful even if receipt email or automated communication delivery is delayed.

## Related App Areas

* `routes/consumer/index.php`
* `app/Livewire/Consumer/ExternalPayment.php`
* `app/Http/Controllers/Consumer/ExternalPaymentQRCodeController.php`
