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

# Invoice

> Event payload details and trigger documentation for Invoice data from Stripe

<img src="https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/stripe.svg?fit=max&auto=format&n=EU2WCxuXGIUQcziR&q=85&s=3273b1407219957e10015da6551db0e4" alt="images/stripe.svg" width="40" height="40" data-path="images/stripe.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Invoice event payload from Stripe.

* `Stripe Invoice Payment Succeeded`
* `Stripe Invoice Payment Failed`
* `Stripe Invoice Created`
* `Stripe Invoice Finalized`

<RequestExample>
  ```json Example theme={null}
  {
    "account_name": "ShedRx Sand",
    "amount_due": 19900,
    "amount_paid": 19900,
    "amount_remaining": 0,
    "billing_reason": "subscription_cycle",
    "charge_id": "ch_3TTWJ9GbiXBLOAVo1zkDONz8",
    "collection_method": "charge_automatically",
    "created_at": null,
    "currency": "usd",
    "customer_email": "customer@example.com",
    "customer_id": "cus_U4jwaMRwkP6qLr",
    "customer_name": "John Doe",
    "effective_at": null,
    "hosted_invoice_url": "https://invoice.stripe.com/i/acct_123/test_abc",
    "id": "in_1TTVMkGbiXBLOAVo4jKaboGP",
    "invoice_pdf": "https://pay.stripe.com/invoice/acct_123/test_abc/pdf",
    "line_items": [
      {
        "amount": 19900,
        "currency": "usd",
        "description": "1 × TEST GLP1 (at $199.00 / month)",
        "id": "il_1TTVLnGbiXBLOAVoultZ5tAh",
        "period_end": null,
        "period_start": null,
        "price_id": "price_1T6aUFGbiXBLOAVoLmslGAvA",
        "product_id": "prod_U4jyPVoMBzHL9i",
        "proration": false,
        "quantity": 1
      }
    ],
    "number": "K7UI7HTV-0008",
    "paid": true,
    "payment_intent_id": "pi_3TTWJ9GbiXBLOAVo1tGehQBT",
    "period_end": null,
    "period_start": null,
    "status": "paid",
    "subscription_id": "sub_1T7OHLGbiXBLOAVoJWWh8tqP",
    "subtotal": 19900,
    "total": 19900
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "account_name": "Name of the Stripe account",
    "amount_due": "Total amount due in cents",
    "amount_paid": "Amount already paid in cents",
    "amount_remaining": "Remaining unpaid amount in cents",
    "billing_reason": "Reason the invoice was created (e.g. subscription_create, subscription_cycle)",
    "charge_id": "The charge associated with payment",
    "collection_method": "How the invoice is collected (charge_automatically or send_invoice)",
    "created_at": "When the invoice was created",
    "currency": "Three-letter ISO currency code",
    "customer_email": "Customer's email address",
    "customer_id": "Stripe customer ID",
    "customer_name": "Customer's full name",
    "effective_at": "When the invoice was finalized",
    "hosted_invoice_url": "URL for the hosted invoice page",
    "id": "Unique identifier for the Stripe invoice",
    "invoice_pdf": "URL for the invoice PDF",
    "line_items": {
      "amount": "Amount in cents",
      "currency": "Three-letter ISO currency code",
      "description": "Description of the line item",
      "id": "Unique identifier for the line item",
      "period_end": "End of the line item period",
      "period_start": "Start of the line item period",
      "price_id": "ID of the price object",
      "product_id": "ID of the product",
      "proration": "Whether this is a proration line item",
      "quantity": "Quantity of the line item"
    },
    "number": "A unique, identifying string displayed on the invoice",
    "paid": "Whether payment was successfully collected for this invoice",
    "payment_intent_id": "The payment intent for this invoice",
    "period_end": "End of the billing period",
    "period_start": "Start of the billing period",
    "status": "Status of the invoice",
    "subscription_id": "The subscription this invoice belongs to",
    "subtotal": "Total before any discounts or taxes in cents",
    "total": "Total after discounts and taxes in cents"
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Invoice" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      Unique identifier for the Stripe invoice

      ```json CEL theme={null}
      id
      ```

      ```json Example theme={null}
      "in_1TTVMkGbiXBLOAVo4jKaboGP"
      ```
    </ResponseField>

    <ResponseField name="status" type="string">
      Status of the invoice

      ```json CEL theme={null}
      status
      ```

      ```json Example theme={null}
      "paid"
      ```
    </ResponseField>

    <ResponseField name="billing_reason" type="string">
      Reason the invoice was created (e.g. subscription\_create, subscription\_cycle)

      ```json CEL theme={null}
      billing_reason
      ```

      ```json Example theme={null}
      "subscription_cycle"
      ```
    </ResponseField>

    <ResponseField name="amount_due" type="int64">
      Total amount due in cents

      ```json CEL theme={null}
      amount_due
      ```

      ```json Example theme={null}
      19900
      ```
    </ResponseField>

    <ResponseField name="amount_paid" type="int64">
      Amount already paid in cents

      ```json CEL theme={null}
      amount_paid
      ```

      ```json Example theme={null}
      19900
      ```
    </ResponseField>

    <ResponseField name="amount_remaining" type="int64">
      Remaining unpaid amount in cents

      ```json CEL theme={null}
      amount_remaining
      ```

      ```json Example theme={null}
      0
      ```
    </ResponseField>

    <ResponseField name="currency" type="string">
      Three-letter ISO currency code

      ```json CEL theme={null}
      currency
      ```

      ```json Example theme={null}
      "usd"
      ```
    </ResponseField>

    <ResponseField name="customer_id" type="string">
      Stripe customer ID

      ```json CEL theme={null}
      customer_id
      ```

      ```json Example theme={null}
      "cus_U4jwaMRwkP6qLr"
      ```
    </ResponseField>

    <ResponseField name="customer_email" type="string">
      Customer's email address

      ```json CEL theme={null}
      customer_email
      ```

      ```json Example theme={null}
      "customer@example.com"
      ```
    </ResponseField>

    <ResponseField name="customer_name" type="string">
      Customer's full name

      ```json CEL theme={null}
      customer_name
      ```

      ```json Example theme={null}
      "John Doe"
      ```
    </ResponseField>

    <ResponseField name="subscription_id" type="string">
      The subscription this invoice belongs to

      ```json CEL theme={null}
      subscription_id
      ```

      ```json Example theme={null}
      "sub_1T7OHLGbiXBLOAVoJWWh8tqP"
      ```
    </ResponseField>

    <ResponseField name="payment_intent_id" type="string">
      The payment intent for this invoice

      ```json CEL theme={null}
      payment_intent_id
      ```

      ```json Example theme={null}
      "pi_3TTWJ9GbiXBLOAVo1tGehQBT"
      ```
    </ResponseField>

    <ResponseField name="charge_id" type="string">
      The charge associated with payment

      ```json CEL theme={null}
      charge_id
      ```

      ```json Example theme={null}
      "ch_3TTWJ9GbiXBLOAVo1zkDONz8"
      ```
    </ResponseField>

    <ResponseField name="number" type="string">
      A unique, identifying string displayed on the invoice

      ```json CEL theme={null}
      number
      ```

      ```json Example theme={null}
      "K7UI7HTV-0008"
      ```
    </ResponseField>

    <ResponseField name="paid" type="bool">
      Whether payment was successfully collected for this invoice

      ```json CEL theme={null}
      paid
      ```

      ```json Example theme={null}
      true
      ```
    </ResponseField>

    <ResponseField name="subtotal" type="int64">
      Total before any discounts or taxes in cents

      ```json CEL theme={null}
      subtotal
      ```

      ```json Example theme={null}
      19900
      ```
    </ResponseField>

    <ResponseField name="total" type="int64">
      Total after discounts and taxes in cents

      ```json CEL theme={null}
      total
      ```

      ```json Example theme={null}
      19900
      ```
    </ResponseField>

    <ResponseField name="hosted_invoice_url" type="string">
      URL for the hosted invoice page

      ```json CEL theme={null}
      hosted_invoice_url
      ```

      ```json Example theme={null}
      "https://invoice.stripe.com/i/acct_123/test_abc"
      ```
    </ResponseField>

    <ResponseField name="invoice_pdf" type="string">
      URL for the invoice PDF

      ```json CEL theme={null}
      invoice_pdf
      ```

      ```json Example theme={null}
      "https://pay.stripe.com/invoice/acct_123/test_abc/pdf"
      ```
    </ResponseField>

    <ResponseField name="created_at" type="timing.v1.Timestamp">
      When the invoice was created

      ```json CEL theme={null}
      created_at
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="effective_at" type="timing.v1.Timestamp">
      When the invoice was finalized

      ```json CEL theme={null}
      effective_at
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="period_start" type="timing.v1.Timestamp">
      Start of the billing period

      ```json CEL theme={null}
      period_start
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="period_end" type="timing.v1.Timestamp">
      End of the billing period

      ```json CEL theme={null}
      period_end
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="line_items" type="[]object" required>
      Line items on the invoice

      ```json CEL theme={null}
      line_items
      ```

      ```json Example theme={null}
      [
      {
      "amount": 19900,
      "currency": "usd",
      "description": "1 × TEST GLP1 (at $199.00 / month)",
      "id": "il_1TTVLnGbiXBLOAVoultZ5tAh",
      "period_end": null,
      "period_start": null,
      "price_id": "price_1T6aUFGbiXBLOAVoLmslGAvA",
      "product_id": "prod_U4jyPVoMBzHL9i",
      "proration": false,
      "quantity": 1
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.id)" type="[]string" required>
      Mapped array of: Unique identifier for the line item

      ```json CEL theme={null}
      line_items.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "il_1TTVLnGbiXBLOAVoultZ5tAh"
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.amount)" type="[]int64" required>
      Mapped array of: Amount in cents

      ```json CEL theme={null}
      line_items.map(x, x.amount)
      ```

      ```json Example theme={null}
      [
      19900
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.currency)" type="[]string" required>
      Mapped array of: Three-letter ISO currency code

      ```json CEL theme={null}
      line_items.map(x, x.currency)
      ```

      ```json Example theme={null}
      [
      "usd"
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.description)" type="[]string" required>
      Mapped array of: Description of the line item

      ```json CEL theme={null}
      line_items.map(x, x.description)
      ```

      ```json Example theme={null}
      [
      "1 × TEST GLP1 (at $199.00 / month)"
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.quantity)" type="[]int64" required>
      Mapped array of: Quantity of the line item

      ```json CEL theme={null}
      line_items.map(x, x.quantity)
      ```

      ```json Example theme={null}
      [
      1
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.price_id)" type="[]string" required>
      Mapped array of: ID of the price object

      ```json CEL theme={null}
      line_items.map(x, x.price_id)
      ```

      ```json Example theme={null}
      [
      "price_1T6aUFGbiXBLOAVoLmslGAvA"
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.product_id)" type="[]string" required>
      Mapped array of: ID of the product

      ```json CEL theme={null}
      line_items.map(x, x.product_id)
      ```

      ```json Example theme={null}
      [
      "prod_U4jyPVoMBzHL9i"
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.period_start)" type="[]timing.v1.Timestamp" required>
      Mapped array of: Start of the line item period

      ```json CEL theme={null}
      line_items.map(x, x.period_start)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.period_end)" type="[]timing.v1.Timestamp" required>
      Mapped array of: End of the line item period

      ```json CEL theme={null}
      line_items.map(x, x.period_end)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="line_items.map(x, x.proration)" type="[]bool" required>
      Mapped array of: Whether this is a proration line item

      ```json CEL theme={null}
      line_items.map(x, x.proration)
      ```

      ```json Example theme={null}
      [
      false
      ]
      ```
    </ResponseField>

    <ResponseField name="collection_method" type="string">
      How the invoice is collected (charge\_automatically or send\_invoice)

      ```json CEL theme={null}
      collection_method
      ```

      ```json Example theme={null}
      "charge_automatically"
      ```
    </ResponseField>

    <ResponseField name="account_name" type="string">
      Name of the Stripe account

      ```json CEL theme={null}
      account_name
      ```

      ```json Example theme={null}
      "ShedRx Sand"
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
