> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.stripe.core.CreateCheckoutSession

- Component: `appmixer.stripe.core.CreateCheckoutSession`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.stripe 3.1.0](https://connectors.appmixer.com/connector/appmixer.stripe/3.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.stripe/3.1.0/component/appmixer.stripe.core.CreateCheckoutSession>

Creates a Stripe-hosted Checkout Session and returns its URL. Send the URL to the customer to pay, start a subscription, or save payment details. The session expires after 24 hours.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Mode (`mode`) | select | Payment accepts a one-time payment, Subscription starts a subscription (at least one recurring price), Setup saves payment details for later. |
| Line Items (`lineItems`) | expression | The prices the customer buys, each with a quantity. Required in Payment and Subscription mode, ignored in Setup mode. |
| Success URL (`successUrl`) | text | The URL Stripe sends the customer to after the payment or setup is complete. |
| Cancel URL (`cancelUrl`) | text | If set, Checkout shows a back button that returns the customer to this URL. |
| Customer ID (`customer`) | text | ID of an existing customer, e.g. cus_NffrFeUfNV2Hib. Leave empty to let Checkout collect the customer's details. |
| Customer Email (`customerEmail`) | text | Prefills the customer's email address. Use either this or Customer ID. |
| Currency (`currency`) | text | Three-letter ISO currency code, e.g. usd. Required in Setup mode. |
| Client Reference ID (`clientReferenceId`) | text | Your own reference for the session, e.g. a cart or order ID (up to 200 characters). |
| Metadata (`metadata`) | key-value | Optional key-value pairs to store on the object, e.g. an order ID from your system. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Session ID (`id`) | string | - |
| Object (`object`) | string | - |
| Checkout URL (`url`) | string,null | - |
| Status (`status`) | string | - |
| Mode (`mode`) | string | - |
| Payment Status (`payment_status`) | string | - |
| Customer ID (`customer`) | string,null | - |
| Customer Email (`customer_email`) | string,null | - |
| Amount Subtotal (`amount_subtotal`) | integer,null | - |
| Amount Total (`amount_total`) | integer,null | - |
| Currency (`currency`) | string,null | - |
| Expires At (Unix Timestamp) (`expires_at`) | integer | - |
| Created (Unix Timestamp) (`created`) | integer | - |
| Success URL (`success_url`) | string,null | - |
| Cancel URL (`cancel_url`) | string,null | - |
| Client Reference ID (`client_reference_id`) | string,null | - |
| Live Mode (`livemode`) | boolean | - |
| Metadata (`metadata`) | object | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.stripe.core.CreateCheckoutSession",
  "description": "Creates a Stripe-hosted Checkout Session and returns its URL. Send the URL to the customer to pay, start a subscription, or save payment details. The session expires after 24 hours.",
  "author": "Appmixer <info@appmixer.com>",
  "version": "1.0.0",
  "auth": {
    "service": "appmixer:stripe"
  },
  "quota": {
    "manager": "appmixer:stripe",
    "resources": "requests"
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "payment",
              "subscription",
              "setup"
            ]
          },
          "lineItems": {
            "type": "object"
          },
          "successUrl": {
            "type": "string"
          },
          "cancelUrl": {
            "type": "string"
          },
          "customer": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "clientReferenceId": {
            "type": "string"
          },
          "metadata": {
            "type": "string"
          }
        },
        "required": [
          "mode",
          "successUrl"
        ]
      },
      "inspector": {
        "inputs": {
          "mode": {
            "type": "select",
            "label": "Mode",
            "index": 1,
            "defaultValue": "payment",
            "tooltip": "Payment accepts a one-time payment, Subscription starts a subscription (at least one recurring price), Setup saves payment details for later.",
            "options": [
              {
                "label": "Payment",
                "value": "payment"
              },
              {
                "label": "Subscription",
                "value": "subscription"
              },
              {
                "label": "Setup",
                "value": "setup"
              }
            ]
          },
          "lineItems": {
            "type": "expression",
            "label": "Line Items",
            "index": 2,
            "tooltip": "The prices the customer buys, each with a quantity. Required in Payment and Subscription mode, ignored in Setup mode.",
            "levels": [
              "AND"
            ],
            "fields": {
              "price": {
                "type": "text",
                "label": "Price ID",
                "index": 1,
                "tooltip": "The ID of a Stripe Price, e.g. price_1MoBy5LkdIwHu7ixZhnattbh."
              },
              "quantity": {
                "type": "number",
                "label": "Quantity",
                "index": 2,
                "defaultValue": 1,
                "tooltip": "The quantity of the price. Defaults to 1."
              }
            }
          },
          "successUrl": {
            "type": "text",
            "label": "Success URL",
            "index": 3,
            "tooltip": "The URL Stripe sends the customer to after the payment or setup is complete."
          },
          "cancelUrl": {
            "type": "text",
            "label": "Cancel URL",
            "index": 4,
            "tooltip": "If set, Checkout shows a back button that returns the customer to this URL."
          },
          "customer": {
            "type": "text",
            "label": "Customer ID",
            "index": 5,
            "tooltip": "ID of an existing customer, e.g. cus_NffrFeUfNV2Hib. Leave empty to let Checkout collect the customer's details."
          },
          "customerEmail": {
            "type": "text",
            "label": "Customer Email",
            "index": 6,
            "tooltip": "Prefills the customer's email address. Use either this or Customer ID."
          },
          "currency": {
            "type": "text",
            "label": "Currency",
            "index": 7,
            "tooltip": "Three-letter ISO currency code, e.g. usd. Required in Setup mode."
          },
          "clientReferenceId": {
            "type": "text",
            "label": "Client Reference ID",
            "index": 8,
            "tooltip": "Your own reference for the session, e.g. a cart or order ID (up to 200 characters)."
          },
          "metadata": {
            "type": "key-value",
            "label": "Metadata",
            "index": 9,
            "tooltip": "Optional key-value pairs to store on the object, e.g. an order ID from your system."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "title": "Session ID",
            "example": "cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u"
          },
          "object": {
            "type": "string",
            "title": "Object",
            "example": "checkout.session"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "title": "Checkout URL",
            "example": "https://checkout.stripe.com/c/pay/cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u"
          },
          "status": {
            "type": "string",
            "title": "Status",
            "example": "open"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "example": "payment"
          },
          "payment_status": {
            "type": "string",
            "title": "Payment Status",
            "example": "unpaid"
          },
          "customer": {
            "type": [
              "string",
              "null"
            ],
            "title": "Customer ID",
            "example": "cus_NffrFeUfNV2Hib"
          },
          "customer_email": {
            "type": [
              "string",
              "null"
            ],
            "title": "Customer Email",
            "example": "jenny.rosen@example.com"
          },
          "amount_subtotal": {
            "type": [
              "integer",
              "null"
            ],
            "title": "Amount Subtotal",
            "example": 2000
          },
          "amount_total": {
            "type": [
              "integer",
              "null"
            ],
            "title": "Amount Total",
            "example": 2000
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "title": "Currency",
            "example": "usd"
          },
          "expires_at": {
            "type": "integer",
            "title": "Expires At (Unix Timestamp)",
            "example": 1679600215
          },
          "created": {
            "type": "integer",
            "title": "Created (Unix Timestamp)",
            "example": 1679513815
          },
          "success_url": {
            "type": [
              "string",
              "null"
            ],
            "title": "Success URL",
            "example": "https://example.com/success"
          },
          "cancel_url": {
            "type": [
              "string",
              "null"
            ],
            "title": "Cancel URL",
            "example": "https://example.com/cancel"
          },
          "client_reference_id": {
            "type": [
              "string",
              "null"
            ],
            "title": "Client Reference ID",
            "example": "order-1001"
          },
          "livemode": {
            "type": "boolean",
            "title": "Live Mode",
            "example": false
          },
          "metadata": {
            "type": "object",
            "title": "Metadata",
            "example": {
              "orderId": "1001"
            }
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
