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

# Kravia invoice delivery

> Override default Kravia invoice delivery by setting invoice_channel to merchant, giving you control over channel, timing, and branding for outgoing invoices.

By default, invoices are delivered to your customers automatically. You can instead choose to deliver invoices yourself by setting `invoice_channel: "merchant"`. This gives you control over the delivery method, timing, and branding. It works with both [customer checkout](/docs/checkout/kravia/checkout) and [merchant initiated](/docs/checkout/kravia/merchant-initiated-payments).

<Warning>
  You need to request access to the invoice delivery feature from support
</Warning>

## How It Works

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Merchant
    participant Dintero
    participant Kravia

    alt Customer Checkout
        Customer->>Dintero: Selects invoice payment
    else Merchant Initiated
        Merchant->>Dintero: POST /v1/sessions/pay
    end

    Dintero->>Kravia: Create invoice (custom distribution)
    Kravia-->>Dintero: Invoice created + PDF URL
    Dintero-->>Merchant: Transaction AUTHORIZED + kravia:invoice_url

    Merchant->>Dintero: POST /v1/transactions/{id}/capture
    Note over Dintero: Status stays AUTHORIZED<br/>INITIATE_CAPTURE event added<br/>Payment details added

    alt Send generated invoice
        Merchant->>Customer: Send PDF URL
    else Generate own invoice
        Merchant->>Merchant: Generate invoice document
        Merchant->>Customer: Send invoice with payment details
    end

    Customer->>Kravia: Pays invoice
    Kravia-->>Dintero: Payment confirmed
    Dintero-->>Merchant: Transaction CAPTURED
    Note over Dintero: settlement_status updates to SETTLED<br/>when funds reach merchant
```

<Warning>
  Before delivering the invoice to the customer, you must call `POST /v1/transactions/{id}/capture` to start collection. The transaction status remains `AUTHORIZED`; an `INITIATE_CAPTURE` event is added to mark that collection has begun. Without this, Kravia will not start collection. If `configuration.auto_capture` is `true`, collection starts immediately, so distribution of the invoice should be done promptly.
</Warning>

## Configuration

Set `invoice_channel: "merchant"` to enable custom distribution.

### Session-Level Configuration (Customer Checkout)

```http theme={null}
POST /v1/sessions-profile
Authorization: Bearer <token>
Content-Type: application/json

{
  "url": {
    "return_url": "https://example.com/accept",
    "callback_url": "https://example.com/callback"
  },
  "order": {
    "amount": 50000,
    "currency": "NOK",
    "merchant_reference": "order-123",
    "items": [ ... ]
  },
  "configuration": {
    "kravia": {
      "type": "payment_type",
      "invoice_b2b": {
        "type": "payment_product_type",
        "enabled": true,
        "days_until_due": 14,
        "invoice_channel": "merchant"
      }
    }
  }
}
```

### Payment Level Configuration (Merchant Initiated)

```http theme={null}
POST /v1/sessions/pay
Authorization: Bearer <token>
Content-Type: application/json

{
  "payment": {
    "payment_product_type": "kravia.invoice_b2b",
    "operation": "invoice_payment",
    "days_until_due": 14,
    "invoice_channel": "merchant"
  },
  "session": {
    "url": {
      "callback_url": "https://example.com/callback"
    },
    "order": {
      "amount": 50000,
      "currency": "NOK",
      "merchant_reference": "inv-2026-001",
      "billing_address": { ... }
    }
  }
}
```

### Configuration Precedence

The value is resolved in this order:

1. **Session/payment configuration** (highest priority)
2. **Checkout payment options** (fallback)
3. **Default**: `"kravia"`

## Delivering the Invoice

After the transaction is `AUTHORIZED`, the Kravia invoice has been created and is ready for delivery. Before you deliver it through your own channel, capture the transaction to start collection with Kravia.

### 1. Capture the Transaction

Call capture to start collection with Kravia:

```http theme={null}
POST /v1/transactions/T12345/capture
Authorization: Bearer <token>
Content-Type: application/json

{
  "amount": 50000,
  "items": [
    {
      "line_id": "1",
      "amount": 50000
    }
  ]
}
```

The transaction status stays `AUTHORIZED`; an `INITIATE_CAPTURE` event is appended to record that collection has started. The transaction will move to `CAPTURED` (or `PARTIALLY_CAPTURED`) once Kravia confirms the shopper has paid.

For shared capture semantics, see [Transaction management](/docs/checkout/transaction-management#capturing).

### 2. Deliver Through Your Channel

Send the invoice to your customer through your own channel, such as email, SMS, a third-party platform, your ERP system, or any other channel.

To send the generated invoice, use the `kravia:invoice_url` value from the transaction metadata to retrieve the generated PDF:

```json theme={null}
{
  "metadata": {
    "kravia:invoice_number": "16788-000018",
    "kravia:invoice_url": "https://checkout.dintero.com/transaction-attachments/..."
  }
}
```

To generate your own invoice document, use the payment details returned in the `INITIATE_CAPTURE` event metadata:

```json theme={null}
{
  "events": [
    {
      "event": "INITIATE_CAPTURE",
      "metadata": {
        "kravia:invoice_number": "16788-000018",
        "kravia:invoice_id": "98765",
        "kravia:payment_details:bank_account:bban": "15063092174",
        "kravia:payment_details:bank_account:iban": "NO0215063092174",
        "kravia:payment_details:bank_account:swift": "DNBANOKKXXX",
        "kravia:payment_details:kid": "300000019497814"
      }
    }
  ]
}
```

These payment details allow the customer's payment to be matched by Kravia.

<Warning>
  Generated invoice documents must match the session data. Kravia uses the session as the source of truth for collection.
</Warning>

## Cancellations

Refund is not supported for Kravia. To cancel an invoice — including one delivered through your own channel — use [`POST /v1/transactions/{id}/void`](/docs/checkout/transaction-management#void-cancel). See [Cancellations in Customer checkout](/docs/checkout/kravia/checkout#cancellations) for the full rules per state.

## See Also

* [Customer Checkout](/docs/checkout/kravia/checkout): customer selects invoice at checkout
* [Merchant Initiated](/docs/checkout/kravia/merchant-initiated-payments): create and pay invoices without customer interaction
