Open Context Protocol is live! πŸš€ Read the launch post
getCheckoutSessionsSessionLineItems

getCheckoutSessionsSessionLineItems

Retrieve a Checkout Session’s line items

Details

  • Method: GET
  • Path: /v1/checkout/sessions/{session}/line_items
  • Operation ID: GetCheckoutSessionsSessionLineItems

Parameters

{
  "ending_before": {
    "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "expand": {
    "description": "Specifies which fields in the response should be expanded.",
    "required": false,
    "location": "query",
    "type": "array"
  },
  "limit": {
    "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "session": {
    "description": "",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "starting_after": {
    "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "description": "",
  "properties": {
    "data": {
      "description": "Details about each object.",
      "items": {
        "description": "A line item.",
        "properties": {
          "amount_discount": {
            "description": "Total discount amount applied. If no discounts were applied, defaults to 0.",
            "type": "integer"
          },
          "amount_subtotal": {
            "description": "Total before any discounts or taxes are applied.",
            "type": "integer"
          },
          "amount_tax": {
            "description": "Total tax amount applied. If no tax was applied, defaults to 0.",
            "type": "integer"
          },
          "amount_total": {
            "description": "Total after discounts and taxes.",
            "type": "integer"
          },
          "currency": {
            "description": "Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).",
            "format": "currency",
            "type": "string"
          },
          "description": {
            "description": "An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.",
            "maxLength": 5000,
            "nullable": true,
            "type": "string"
          },
          "discounts": {
            "description": "The discounts applied to the line item.",
            "items": {
              "description": "",
              "properties": {
                "amount": {
                  "description": "The amount discounted.",
                  "type": "integer"
                },
                "discount": {
                  "description": "A discount represents the actual application of a [coupon](https://api.stripe.com#coupons) or [promotion code](https://api.stripe.com#promotion_codes).\nIt contains information about when the discount began, when it will end, and what it is applied to.\n\nRelated guide: [Applying discounts to subscriptions](https://docs.stripe.com/billing/subscriptions/discounts)",
                  "properties": {
                    "checkout_session": {
                      "description": "The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "customer": {
                      "anyOf": [
                        {
                          "maxLength": 5000,
                          "type": "string"
                        },
                        {
                          "$ref": "#/components/schemas/customer"
                        },
                        {
                          "$ref": "#/components/schemas/deleted_customer"
                        }
                      ],
                      "description": "The ID of the customer associated with this discount.",
                      "nullable": true,
                      "x-expansionResources": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/customer"
                          },
                          {
                            "$ref": "#/components/schemas/deleted_customer"
                          }
                        ]
                      }
                    },
                    "customer_account": {
                      "description": "The ID of the account representing the customer associated with this discount.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "end": {
                      "description": "If the coupon has a duration of `repeating`, the date that this discount will end. If the coupon has a duration of `once` or `forever`, this attribute will be null.",
                      "format": "unix-time",
                      "nullable": true,
                      "type": "integer"
                    },
                    "id": {
                      "description": "The ID of the discount object. Discounts cannot be fetched by ID. Use `expand[]=discounts` in API calls to expand discount IDs in an array.",
                      "maxLength": 5000,
                      "type": "string"
                    },
                    "invoice": {
                      "description": "The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "invoice_item": {
                      "description": "The invoice item `id` (or invoice line item `id` for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "object": {
                      "description": "String representing the object's type. Objects of the same type share the same value.",
                      "enum": [
                        "discount"
                      ],
                      "type": "string"
                    },
                    "promotion_code": {
                      "anyOf": [
                        {
                          "maxLength": 5000,
                          "type": "string"
                        },
                        {
                          "$ref": "#/components/schemas/promotion_code"
                        }
                      ],
                      "description": "The promotion code applied to create this discount.",
                      "nullable": true,
                      "x-expansionResources": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/promotion_code"
                          }
                        ]
                      }
                    },
                    "source": {
                      "description": "",
                      "properties": {
                        "coupon": {
                          "anyOf": [
                            {
                              "maxLength": 5000,
                              "type": "string"
                            },
                            {
                              "$ref": "#/components/schemas/coupon"
                            }
                          ],
                          "description": "The coupon that was redeemed to create this discount.",
                          "nullable": true,
                          "x-expansionResources": {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/coupon"
                              }
                            ]
                          }
                        },
                        "type": {
                          "description": "The source type of the discount.",
                          "enum": [
                            "coupon"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "title": "DiscountSource",
                      "type": "object",
                      "x-expandableFields": [
                        "coupon"
                      ]
                    },
                    "start": {
                      "description": "Date that the coupon was applied.",
                      "format": "unix-time",
                      "type": "integer"
                    },
                    "subscription": {
                      "description": "The subscription that this coupon is applied to, if it is applied to a particular subscription.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "subscription_item": {
                      "description": "The subscription item that this coupon is applied to, if it is applied to a particular subscription item.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "source",
                    "start"
                  ],
                  "title": "Discount",
                  "type": "object",
                  "x-expandableFields": [
                    "customer",
                    "promotion_code",
                    "source"
                  ],
                  "x-resourceId": "discount"
                }
              },
              "required": [
                "amount",
                "discount"
              ],
              "title": "LineItemsDiscountAmount",
              "type": "object",
              "x-expandableFields": [
                "discount"
              ]
            },
            "type": "array"
          },
          "id": {
            "description": "Unique identifier for the object.",
            "maxLength": 5000,
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {
              "maxLength": 500,
              "type": "string"
            },
            "description": "Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.",
            "nullable": true,
            "type": "object"
          },
          "object": {
            "description": "String representing the object's type. Objects of the same type share the same value.",
            "enum": [
              "item"
            ],
            "type": "string"
          },
          "price": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/price"
              }
            ],
            "description": "The price used to generate the line item.",
            "nullable": true
          },
          "quantity": {
            "description": "The quantity of products being purchased.",
            "nullable": true,
            "type": "integer"
          },
          "taxes": {
            "description": "The taxes applied to the line item.",
            "items": {
              "description": "",
              "properties": {
                "amount": {
                  "description": "Amount of tax applied for this rate.",
                  "type": "integer"
                },
                "rate": {
                  "description": "Tax rates can be applied to [invoices](/invoicing/taxes/tax-rates), [subscriptions](/billing/taxes/tax-rates) and [Checkout Sessions](/payments/checkout/use-manual-tax-rates) to collect tax.\n\nRelated guide: [Tax rates](/billing/taxes/tax-rates)",
                  "properties": {
                    "active": {
                      "description": "Defaults to `true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.",
                      "type": "boolean"
                    },
                    "country": {
                      "description": "Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "created": {
                      "description": "Time at which the object was created. Measured in seconds since the Unix epoch.",
                      "format": "unix-time",
                      "type": "integer"
                    },
                    "description": {
                      "description": "An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "display_name": {
                      "description": "The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.",
                      "maxLength": 5000,
                      "type": "string"
                    },
                    "effective_percentage": {
                      "description": "Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true,\nthis percentage reflects the rate actually used to calculate tax based on the product's taxability\nand whether the user is registered to collect taxes in the corresponding jurisdiction.",
                      "nullable": true,
                      "type": "number"
                    },
                    "flat_amount": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/tax_rate_flat_amount"
                        }
                      ],
                      "description": "The amount of the tax rate when the `rate_type` is `flat_amount`. Tax rates with `rate_type` `percentage` can vary based on the transaction, resulting in this field being `null`. This field exposes the amount and currency of the flat tax rate.",
                      "nullable": true
                    },
                    "id": {
                      "description": "Unique identifier for the object.",
                      "maxLength": 5000,
                      "type": "string"
                    },
                    "inclusive": {
                      "description": "This specifies if the tax rate is inclusive or exclusive.",
                      "type": "boolean"
                    },
                    "jurisdiction": {
                      "description": "The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "jurisdiction_level": {
                      "description": "The level of the jurisdiction that imposes this tax rate. Will be `null` for manually defined tax rates.",
                      "enum": [
                        "city",
                        "country",
                        "county",
                        "district",
                        "multiple",
                        "state"
                      ],
                      "nullable": true,
                      "type": "string"
                    },
                    "livemode": {
                      "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.",
                      "type": "boolean"
                    },
                    "metadata": {
                      "additionalProperties": {
                        "maxLength": 500,
                        "type": "string"
                      },
                      "description": "Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.",
                      "nullable": true,
                      "type": "object"
                    },
                    "object": {
                      "description": "String representing the object's type. Objects of the same type share the same value.",
                      "enum": [
                        "tax_rate"
                      ],
                      "type": "string"
                    },
                    "percentage": {
                      "description": "Tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage includes the statutory tax rate of non-taxable jurisdictions.",
                      "type": "number"
                    },
                    "rate_type": {
                      "description": "Indicates the type of tax rate applied to the taxable amount. This value can be `null` when no tax applies to the location. This field is only present for TaxRates created by Stripe Tax.",
                      "enum": [
                        "flat_amount",
                        "percentage"
                      ],
                      "nullable": true,
                      "type": "string"
                    },
                    "state": {
                      "description": "[ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2), without country prefix. For example, \"NY\" for New York, United States.",
                      "maxLength": 5000,
                      "nullable": true,
                      "type": "string"
                    },
                    "tax_type": {
                      "description": "The high-level tax type, such as `vat` or `sales_tax`.",
                      "enum": [
                        "amusement_tax",
                        "communications_tax",
                        "gst",
                        "hst",
                        "igst",
                        "jct",
                        "lease_tax",
                        "pst",
                        "qst",
                        "retail_delivery_fee",
                        "rst",
                        "sales_tax",
                        "service_tax",
                        "vat"
                      ],
                      "nullable": true,
                      "type": "string",
                      "x-stripeBypassValidation": true
                    }
                  },
                  "required": [
                    "active",
                    "created",
                    "display_name",
                    "id",
                    "inclusive",
                    "livemode",
                    "object",
                    "percentage"
                  ],
                  "title": "TaxRate",
                  "type": "object",
                  "x-expandableFields": [
                    "flat_amount"
                  ],
                  "x-resourceId": "tax_rate"
                },
                "taxability_reason": {
                  "description": "The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.",
                  "enum": [
                    "customer_exempt",
                    "not_collecting",
                    "not_subject_to_tax",
                    "not_supported",
                    "portion_product_exempt",
                    "portion_reduced_rated",
                    "portion_standard_rated",
                    "product_exempt",
                    "product_exempt_holiday",
                    "proportionally_rated",
                    "reduced_rated",
                    "reverse_charge",
                    "standard_rated",
                    "taxable_basis_reduced",
                    "zero_rated"
                  ],
                  "nullable": true,
                  "type": "string",
                  "x-stripeBypassValidation": true
                },
                "taxable_amount": {
                  "description": "The amount on which tax is calculated, in cents (or local equivalent).",
                  "nullable": true,
                  "type": "integer"
                }
              },
              "required": [
                "amount",
                "rate"
              ],
              "title": "LineItemsTaxAmount",
              "type": "object",
              "x-expandableFields": [
                "rate"
              ]
            },
            "type": "array"
          }
        },
        "required": [
          "amount_discount",
          "amount_subtotal",
          "amount_tax",
          "amount_total",
          "currency",
          "id",
          "object"
        ],
        "title": "LineItem",
        "type": "object",
        "x-expandableFields": [
          "discounts",
          "price",
          "taxes"
        ],
        "x-resourceId": "item"
      },
      "type": "array"
    },
    "has_more": {
      "description": "True if this list has another page of items after this one that can be fetched.",
      "type": "boolean"
    },
    "object": {
      "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.",
      "enum": [
        "list"
      ],
      "type": "string"
    },
    "url": {
      "description": "The URL where this list can be accessed.",
      "maxLength": 5000,
      "type": "string"
    }
  },
  "required": [
    "data",
    "has_more",
    "object",
    "url"
  ],
  "title": "PaymentPagesCheckoutSessionListLineItems",
  "type": "object",
  "x-expandableFields": [
    "data"
  ]
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('stripe')

# Call this tool
result = await agent.call_tool('getCheckoutSessionsSessionLineItems', {
    # Add required parameters here
})