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

# Create invoice

> Creates a new checkout invoice for the authenticated store.
Returns a legacy error shape on some validation failures for backward compatibility.




## OpenAPI

````yaml /openapi.yaml post /v1/invoices
openapi: 3.1.0
info:
  title: Meum Public Merchant API
  version: 1.0.0
  description: >
    Public merchant API for programmatic payment management: invoices,
    transactions,

    payment links, webhooks, and WooCommerce integration.


    Authenticate with a store-scoped API key (`sk_live_*`) via Bearer token.

    Base URL: https://api.meum.io
  contact:
    name: Meum Support
    email: support@meum.io
    url: https://meum.io
servers:
  - url: https://api.meum.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Service health checks
  - name: Invoices
    description: Invoice lifecycle
  - name: Transactions
    description: On-chain payment transactions
  - name: Payment Links
    description: Reusable payment link management
  - name: Webhooks
    description: Webhook endpoint and delivery management
  - name: Integrations
    description: Third-party platform integrations
paths:
  /v1/invoices:
    post:
      tags:
        - Invoices
      summary: Create invoice
      description: >
        Creates a new checkout invoice for the authenticated store.

        Returns a legacy error shape on some validation failures for backward
        compatibility.
      operationId: createInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceRequest'
            example:
              external_order_id: order_demo_1048
              amount: '100.00'
              currency: USD
              return_url: https://shop.example.com/thank-you
              metadata:
                line_items: 2
      responses:
        '201':
          description: Invoice created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceCreateResponse'
        '400':
          description: Bad request (legacy error shape)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden (legacy error shape)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict (legacy error shape)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limited (legacy error shape)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateInvoiceRequest:
      type: object
      required:
        - external_order_id
        - amount
      properties:
        store_id:
          type: string
          format: uuid
          description: >
            Which store this invoice belongs to. **Optional**: uses your API
            key's default store if omitted.

            Must match the store tied to your API key when provided.
        integration_id:
          type: string
          format: uuid
          description: >
            **Optional.** Link this invoice to a connected platform (e.g.
            WooCommerce).

            Omit unless you received this ID from a platform integration.
        external_order_id:
          type: string
          description: >
            **Required.** Your own order or reference number (e.g.
            `"order_1048"`).

            Sent back in webhooks so you can match payments to orders in your
            system.
          example: order_demo_1048
        amount:
          type: string
          description: >
            **Required.** How much you want to receive, as a decimal string
            (e.g. `"100.00"`).

            This is the amount after currency conversion, in the currency below.
          example: '100.00'
        currency:
          type: string
          default: USD
          description: >
            **Optional.** Three-letter currency code for `amount` (e.g. `USD`,
            `EUR`).

            Defaults to `USD` if omitted.
          example: USD
        callback_url:
          type: string
          format: uri
          description: >
            **Optional.** Legacy server callback URL. For new integrations, use
            Webhooks instead.

            Omit if you rely on webhooks.
        return_url:
          type: string
          format: uri
          description: >
            **Optional.** Where to send the customer after they finish or cancel
            checkout.

            Omit if you handle completion via webhooks only.
        metadata:
          type: object
          additionalProperties: true
          description: >
            **Optional.** Custom data attached to the invoice (e.g. `{"cart_id":
            "abc"}`).

            Returned in webhooks. Omit if you don't need extra fields.
    InvoiceCreateResponse:
      type: object
      properties:
        id:
          type: string
          pattern: ^(inv_|txn_|plink_|wh_|whd_|evt_|int_)[0-9a-z]{20,32}$
          description: >-
            Unique invoice ID starting with `inv_`. Save this to check status or
            handle webhooks.
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        checkout_url:
          type: string
          format: uri
          description: >
            Send your customer to this URL to pay (e.g.
            `https://pay.meum.io/...`).

            Open in a browser or redirect from your site.
          example: https://pay.meum.io/550e8400-e29b-41d4-a716-446655440000
        payment_url:
          type: string
          format: uri
          description: >-
            Same as `checkout_url`. Kept for older integrations; prefer
            `checkout_url`.
        amount:
          type: string
          description: Invoice amount as a decimal string (e.g. `"100.00"`).
          example: '100.00'
        currency:
          type: string
          description: Currency code for `amount` (e.g. `USD`).
          example: USD
        output_asset:
          type: string
          description: Stablecoin you receive when paid (e.g. `USDC`).
          example: USDC
        expires_at:
          type: string
          format: date-time
          description: >-
            When this invoice stops accepting payment if still unpaid (UTC, e.g.
            `2025-09-01T14:31:44.171Z`).
    ErrorResponse:
      type: object
      description: >
        Legacy flat error shape retained for backward compatibility on invoice
        create

        and WooCommerce integration endpoints.
      properties:
        error:
          type: string
          description: Human-readable error message.
          example: Payout wallet not configured
        code:
          type: string
          description: Machine-readable error code for legacy endpoints.
          example: EXTERNAL_ORDER_INTEGRATION_CONFLICT
        details:
          type: object
          additionalProperties:
            type: string
          description: Optional key-value context with field-level validation errors.
    InvoiceStatus:
      type: string
      description: |
        Where the invoice is in the payment flow:
        - `pending`: created, not yet ready for payment
        - `quoted`: price quote ready; customer can proceed to pay
        - `awaiting_payment`: waiting for the customer to send funds
        - `paid`: payment received and confirmed
        - `underpaid`: customer paid less than the requested amount
        - `expired`: not paid before the deadline
        - `failed`: payment or processing failed
        - `refunded`: payment was returned to the customer
        - `cancelled`: invoice was cancelled before completion
      enum:
        - pending
        - quoted
        - awaiting_payment
        - paid
        - underpaid
        - expired
        - failed
        - refunded
        - cancelled
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        Store-scoped API key. Prefix with `sk_live_`.
        Example: `Authorization: Bearer sk_live_EXAMPLE_DO_NOT_USE`

````