### GET /v1/setup_intents Source: https://docs.withflex.com/api-reference/setup-intents/list-setup-intents Retrieves a list of setup intents. This endpoint supports filtering and pagination. ```APIDOC ## GET /v1/setup_intents ### Description Retrieves a list of setup intents. This endpoint allows for filtering by customer and pagination using limit, offset, starting_after, and ending_before parameters. ### Method GET ### Endpoint https://api.withflex.com/v1/setup_intents ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of setup intents to return. - **offset** (integer) - Optional - The number of setup intents to skip before returning results. - **customer** (string) - Optional - Filter setup intents by customer ID. - **starting_after** (string) - Optional - Returns setup intents after this ID. - **ending_before** (string) - Optional - Returns setup intents before this ID. #### Request Body This endpoint does not accept a request body. ### Request Example ``` GET /v1/setup_intents?limit=10&customer=fcus_12345 ``` ### Response #### Success Response (200) - **setup_intents** (array) - An array of setup intent objects. - **setup_intent_id** (string) - The unique identifier for the setup intent. - **client_secret** (string) - The client secret for the setup intent. - **customer** (object) - Details of the customer associated with the setup intent. - **customer_id** (string) - The unique identifier for the customer. - **first_name** (string) - The first name of the customer. - **last_name** (string) - The last name of the customer. - **email** (string) - The email address of the customer. - **phone** (string) - The phone number of the customer. - **employer** (string) - The employer of the customer. - **shipping** (object) - Shipping address details. - **shipping_address_id** (string) - The unique identifier for the shipping address. - **line1** (string) - The first line of the shipping address. - **line2** (string) - The second line of the shipping address. - **city** (string) - The city of the shipping address. - **state** (string) - The state of the shipping address. - **postal_code** (string) - The postal code of the shipping address. - **country** (string) - The country of the shipping address. - **metadata** (object) - Custom key-value pairs for the customer. - **created_at** (string) - The timestamp when the customer was created. - **test_mode** (boolean) - Indicates if the customer was created in test mode. - **description** (string) - A description for the setup intent. - **payment_method** (string) - The payment method associated with the setup intent. - **partner_id** (string) - The identifier of the partner. - **metadata** (object) - Custom key-value pairs for the setup intent. - **created_at** (string) - The timestamp when the setup intent was created. - **test_mode** (boolean) - Indicates if the setup intent was created in test mode. - **status** (string) - The current status of the setup intent (e.g., `requires_payment_method`). - **usage** (string) - The usage type for the setup intent (e.g., `off_session`). #### Response Example ```json { "setup_intents": [ { "setup_intent_id": "", "client_secret": "", "customer": { "customer_id": "fcus_01HACM7FZ1084XB1GB6053VM0D", "first_name": "John", "last_name": "Doe", "email": "joh.doe@example.com", "phone": "+15555555555", "employer": "Flex", "shipping": { "shipping_address_id": "", "line1": "", "line2": "", "city": "", "state": "", "postal_code": "", "country": "" }, "metadata": {}, "created_at": "", "test_mode": true }, "description": "", "payment_method": "", "partner_id": "", "metadata": {}, "created_at": "", "test_mode": true, "status": "requires_payment_method", "usage": "off_session" } ] } ``` #### Error Response (401) - **code** (string) - The error code. - **detail** (string) - A description of the error. #### Error Response Example (401) ```json { "code": "", "detail": "" } ``` #### Error Response (403) - **code** (string) - The error code. - **detail** (string) - A description of the error. #### Error Response Example (403) ```json { "code": "", "detail": "" } ``` #### Error Response (404) - **code** (string) - The error code. - **detail** (string) - A description of the error. #### Error Response Example (404) ```json { "code": "", "detail": "" } ``` #### Error Response (409) - **code** (string) - The error code. - **detail** (string) - A description of the error. #### Error Response Example (409) ```json { "code": "", "detail": "" } ``` ``` -------------------------------- ### Getting Started Section with Cards - HTML/JSX Source: https://docs.withflex.com/index This JSX code renders a 'Let's get started' section with a group of cards. Each card links to a specific area of the Flex documentation, such as Developer Guides, API Reference, Marketing resources, and the Changelog. The layout is designed for two columns on larger screens. It utilizes custom `CardGroup` and `Card` components. ```jsx

Let's get started

Complete guides for integrating HSA/FSA payments with Flex. Comprehensive API reference for developers using Flex. Resources and assets to help promote Flex HSA/FSA payments. Latest updates and improvements to Flex.
``` -------------------------------- ### Get Promo Code Details Source: https://docs.withflex.com/api-reference/promo-codes/create-promo-code Retrieves metadata and example associated with a given promo code. ```APIDOC ## GET /llmstxt/withflex_llms_txt ### Description Retrieves metadata and example associated with a given promo code. ### Method GET ### Endpoint /llmstxt/withflex_llms_txt ### Parameters #### Query Parameters - **fcus_01HACM7FZ1084XB1GB6053VM0D** (string) - Required - The promo code identifier. ### Response #### Success Response (200) - **metadata** (object) - Metadata associated with the promo code. - **description** (string) - Description of the metadata. - **type** (string) - The data type of the metadata. - **nullable** (boolean) - Indicates if the metadata can be null. - **example** (object) - An example of the metadata structure. - **key** (string) - Example key for the metadata. - **value** (string) - Example value for the metadata. #### Response Example ```json { "fcus_01HACM7FZ1084XB1GB6053VM0D": { "metadata": { "description": "Metadata associated with the promo code.", "type": "object", "nullable": true, "example": { "key": "value" } } } } ``` ``` -------------------------------- ### GET /v1/setup_intents/{id} Source: https://docs.withflex.com/api-reference/setup-intents/get-setup-intent Retrieves a specific setup intent by its unique identifier. This endpoint is useful for checking the status or details of a previously created setup intent. ```APIDOC ## GET /v1/setup_intents/{id} ### Description Retrieves a specific setup intent by its unique identifier. This endpoint is useful for checking the status or details of a previously created setup intent. ### Method GET ### Endpoint /v1/setup_intents/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the setup intent. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **setup_intent** (object) - Contains the details of the setup intent. - **setup_intent_id** (string) - The ID of the setup intent. - **client_secret** (string) - The client secret for the setup intent. - **customer** (object) - Details about the associated customer. - **customer_id** (string) - The ID of the customer. - **first_name** (string) - The first name of the customer. - **last_name** (string) - The last name of the customer. - **email** (string) - The email address of the customer. - **phone** (string) - The phone number of the customer. - **employer** (string) - The employer of the customer. - **shipping** (object) - Shipping address details. - **shipping_address_id** (string) - The ID of the shipping address. - **line1** (string) - The first line of the shipping address. - **line2** (string) - The second line of the shipping address. - **city** (string) - The city of the shipping address. - **state** (string) - The state of the shipping address. - **postal_code** (string) - The postal code of the shipping address. - **country** (string) - The country of the shipping address. - **metadata** (object) - Custom metadata for the customer. - **created_at** (string) - Timestamp of when the customer was created. - **test_mode** (boolean) - Indicates if the customer is in test mode. - **description** (string) - A description for the setup intent. - **payment_method** (string) - The payment method associated with the setup intent. - **partner_id** (string) - The ID of the partner associated with the setup intent. - **metadata** (object) - Custom metadata for the setup intent. - **created_at** (string) - Timestamp of when the setup intent was created. - **test_mode** (boolean) - Indicates if the setup intent is in test mode. - **status** (string) - The current status of the setup intent (e.g., `requires_payment_method`). - **usage** (string) - The intended usage of the setup intent (e.g., `off_session`). #### Error Response (401) - **code** (string) - An error code. - **detail** (string) - A detailed error message. #### Error Response (403) - **code** (string) - An error code. - **detail** (string) - A detailed error message. #### Error Response (404) - **code** (string) - An error code. - **detail** (string) - A detailed error message. #### Error Response (409) - **code** (string) - An error code. - **detail** (string) - A detailed error message. #### Error Response (422) - **detail** (array) - A list of validation errors. - **loc** (array) - Location of the error in the request. - **msg** (string) - The error message. - **type** (string) - The type of error. #### Error Response (429) - (Details not provided in the source) ### Response Example (200) ```json { "setup_intent": { "setup_intent_id": "", "client_secret": "", "customer": { "customer_id": "fcus_01HACM7FZ1084XB1GB6053VM0D", "first_name": "John", "last_name": "Doe", "email": "joh.doe@example.com", "phone": "+15555555555", "employer": "Flex", "shipping": { "shipping_address_id": "", "line1": "", "line2": "", "city": "", "state": "", "postal_code": "", "country": "" }, "metadata": {}, "created_at": "", "test_mode": true }, "description": "", "payment_method": "", "partner_id": "", "metadata": {}, "created_at": "", "test_mode": true, "status": "requires_payment_method", "usage": "off_session" } } ``` ### Response Example (401) ```json { "code": "", "detail": "" } ``` ### Response Example (404) ```json { "code": "", "detail": "" } ``` ### Response Example (422) ```json { "detail": [ { "loc": [ "" ], "msg": "", "type": "" } ] } ``` ``` -------------------------------- ### Flex Product Creation Response Source: https://docs.withflex.com/developer-guides/integration/checkout/quick-start Example JSON response after successfully creating a product with the Flex API. It includes the unique product ID, name, creation timestamp, and other product attributes. ```json { "product": { "product_id": "fprod_01HW5MXAPBE79RHMMJJGB4ACAB", "name": "Test Product", "description": "Test Product Description", "created_at": "2024-04-23T14:14:16.029253Z", "visit_type": "gym", "active": true, "upc_code": null, "gtin": null, "hsa_fsa_eligibility": "letter_of_medical_necessity" } } ``` -------------------------------- ### POST /v1/products Source: https://docs.withflex.com/developer-guides/subscriptions/getting-started Create a new product to sell. Sensitive information like price and availability should be managed on the server. ```APIDOC ## POST /v1/products ### Description Creates a new product with specified details. It's recommended to keep product inventory details on your server. ### Method POST ### Endpoint https://api.withflex.com/v1/products ### Parameters #### Request Body - **product** (object) - Required - Contains product details. - **name** (string) - Required - The name of the product. - **description** (string) - Optional - A description of the product. - **visit_type** (string) - Optional - The type of visit associated with the product (e.g., 'gym'). - **hsa_fsa_eligibility** (string) - Optional - Eligibility for HSA/FSA (e.g., 'letter_of_medical_necessity'). ### Request Example ```json { "product": { "name": "Test Product", "description": "Test Product Description", "visit_type": "gym", "hsa_fsa_eligibility": "letter_of_medical_necessity" } } ``` ### Response #### Success Response (200) - **product** (object) - Details of the created product. - **product_id** (string) - The unique identifier for the product. - **name** (string) - The name of the product. - **description** (string) - The description of the product. - **created_at** (string) - Timestamp of creation. - **visit_type** (string) - The type of visit. - **active** (boolean) - Indicates if the product is active. - **upc_code** (string|null) - UPC code if available. - **gtin** (string|null) - GTIN if available. - **hsa_fsa_eligibility** (string|null) - HSA/FSA eligibility status. #### Response Example ```json { "product": { "product_id": "fprod_01HW5MXAPBE79RHMMJJGB4ACAB", "name": "Test Product", "description": "Test Product Description", "created_at": "2024-04-23T14:14:16.029253Z", "visit_type": "gym", "active": true, "upc_code": null, "gtin": null, "hsa_fsa_eligibility": "letter_of_medical_necessity" } } ``` ``` -------------------------------- ### SetupIntent Object Structure Source: https://docs.withflex.com/api-reference/setup-intents/list-setup-intents Details the fields and their types for a SetupIntent object. This includes setup intent ID, client secret, customer, description, payment method, partner ID, metadata, creation timestamp, test mode status, object status, and intended usage. ```APIDOC ## SetupIntent Object ### Description Represents an object used to set up and confirm a customer's payment method for future use. ### Properties - **setup_intent_id** (string) - Description: The unique identifier for the object. - **client_secret** (string, nullable) - Description: A secret used to complete client-side actions. - **customer** (Expandable_for_Customer, nullable) - Description: The ID of the Customer this SetupIntent belongs to. - **description** (string, nullable) - Description: An arbitrary string attached to the setup intent. - **payment_method** (string, nullable) - Description: Payment method used with this SetupIntent. - **partner_id** (string) - Description: The ID of the Partner associated with this SetupIntent. - **metadata** (object, nullable) - Description: Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - **additionalProperties** (object) - Allows arbitrary key-value pairs. - **created_at** (Timestamptz) - Description: Time at which the object was created. ISO 8601 format. - **test_mode** (boolean) - Description: Whether or not the setup intent is in test mode. - **status** (Status2) - Description: Status of the SetupIntent. One of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `succeeded`, or `canceled`. - **usage** (Usage) - Description: Indicates how the payment method is intended to be used in the future. ### Enum Definitions #### Status2 - Type: string - Enum: - `requires_payment_method` - `requires_confirmation` - `requires_action` - `processing` - `succeeded` - `canceled` #### Usage - Type: string - Enum: - `off_session` - `on_session` ``` -------------------------------- ### Subscription Provisioning and Monitoring Source: https://docs.withflex.com/developer-guides/subscriptions/getting-started Guidance on provisioning subscriptions upon successful checkout and handling subsequent payment events. ```APIDOC ## Subscription Management ### Description After a customer successfully completes a checkout session, they are redirected to the `success_url`. This action typically triggers a `checkout.session.completed` event. Your system should listen for this event to provision the subscription. Subsequent billing cycles are managed by monitoring `invoice.paid` events. In case of payment failures, the `invoice.payment_failed` event should be handled to notify the customer and take appropriate action. To determine the correct logic for your system, examine the event type and parse the payload of each event, paying close attention to `invoice.paid` events. It is recommended to store the `subscription_id` and `customer_id` from these event objects in your database for verification purposes. ### Event Types - **checkout.session.completed**: Triggered when a checkout session is successfully completed. - **invoice.paid**: Triggered when an invoice is successfully paid, indicating a successful billing cycle. - **invoice.payment_failed**: Triggered when an invoice payment fails. ### Data Storage Recommendations - Store `subscription_id` for ongoing subscription management. - Store `customer_id` for associating subscriptions with specific customers. ``` -------------------------------- ### Flex Shopify Payments App Installation Guide Source: https://context7_llms Step-by-step instructions for setting up your Flex account and configuring the Flex Shopify payment app. This enables accepting HSA/FSA payments directly within the Shopify checkout process. ```Text 1. Install the Flex app from the Shopify App Store. 2. Connect your Flex account to your Shopify store. 3. Configure payment settings, including which products are eligible for HSA/FSA payments. 4. Ensure your Shopify checkout is set to use Flex as a payment provider. ``` -------------------------------- ### POST /v1/setup_intents Source: https://docs.withflex.com/api-reference/setup-intents/post-v1setup_intents Creates a new SetupIntent object, which represents your intention to collect future payments without the immediate presence of card details or 3D Secure authentication. It is used to set up and confirm a payment method for future transactions. ```APIDOC ## POST /v1/setup_intents ### Description Creates a new SetupIntent object, which represents your intention to collect future payments without the immediate presence of card details or 3D Secure authentication. It is used to set up and confirm a payment method for future transactions. ### Method POST ### Endpoint https://api.withflex.com/v1/setup_intents ### Parameters #### Header Parameters - **Authorization** (string) - Required - Use a Bearer token to access this API. #### Request Body - **setup_intent** (object) - Required - Contains the details for creating the SetupIntent. - **partner_id** (string) - Required - The ID of the partner. - **checkout_session** (string) - Required - The ID of the checkout session. ### Request Example ```json { "setup_intent": { "partner_id": "", "checkout_session": "" } } ``` ### Response #### Success Response (200) - **setup_intent** (object) - The created SetupIntent object. - **setup_intent_id** (string) - The unique identifier for the SetupIntent. - **client_secret** (string) - A client-side secret used to create the SetupIntent on the client. - **customer** (object) - Information about the customer associated with the SetupIntent. - **customer_id** (string) - The unique identifier for the customer. - **first_name** (string) - The customer's first name. - **last_name** (string) - The customer's last name. - **email** (string) - The customer's email address. - **phone** (string, nullable) - The customer's phone number. - **employer** (string, nullable) - The customer's employer. - **shipping** (object, nullable) - The customer's shipping address. - **shipping_address_id** (string) - The ID of the shipping address. - **line1** (string, nullable) - **line2** (string, nullable) - **city** (string, nullable) - **state** (string, nullable) - **postal_code** (string, nullable) - **country** (string, nullable) - **metadata** (object, nullable) - Metadata associated with the customer. - **created_at** (string) - The time the customer was created. - **test_mode** (boolean) - Whether the customer was created in test mode. - **description** (string) - A description of the SetupIntent. - **payment_method** (string) - The payment method associated with the SetupIntent. - **partner_id** (string) - The ID of the partner. - **metadata** (object) - Metadata associated with the SetupIntent. - **created_at** (string) - The time the SetupIntent was created. - **test_mode** (boolean) - Whether the SetupIntent was created in test mode. - **status** (string) - The current status of the SetupIntent (e.g., requires_payment_method). - **usage** (string) - Indicates the intended usage of the payment method (e.g., off_session). #### Response Example ```json { "setup_intent": { "setup_intent_id": "", "client_secret": "", "customer": { "customer_id": "fcus_01HACM7FZ1084XB1GB6053VM0D", "first_name": "John", "last_name": "Doe", "email": "joh.doe@example.com", "phone": "+15555555555", "employer": "Flex", "shipping": { "shipping_address_id": "", "line1": "", "line2": "", "city": "", "state": "", "postal_code": "", "country": "" }, "metadata": {}, "created_at": "", "test_mode": true }, "description": "", "payment_method": "", "partner_id": "", "metadata": {}, "created_at": "", "test_mode": true, "status": "requires_payment_method", "usage": "off_session" } } ``` ``` -------------------------------- ### Get All Balance Transactions (JSON Response) Source: https://docs.withflex.com/developer-guides/integration/payouts-balance-transactions Example JSON response for the 'Get All Balance Transactions' endpoint. This structure includes a list of balance transactions, each with details like amount, dates, fees, and status. ```json { "balance_transactions": [ { "balance_transaction_id": "fbtxn_01k5g4xv968zg8t2jvhbdn9d5t", "amount": -49901, "available_on": "2025-09-17T00:00:00Z", "created_at": "2025-09-16T01:19:06Z", "exchange_rate": null, "fee": 0, "net": -49901, "reporting_category": "payout", "checkout_session_id": null, "client_reference_id": null, "status": "available", "source_id": "fpo_01k5amhe3gcndv5ezv1mx0svct", "type": "payout", "test_mode": false }, { "balance_transaction_id": "fbtxn_01k5g4xv9dbaa01fnta41a3rt7", "amount": 18438, "available_on": "2025-09-17T00:00:00Z", "created_at": "2025-09-15T07:26:43Z", "exchange_rate": null, "fee": 675, "net": 17763, "reporting_category": "charge", "checkout_session_id": "fcs_01k5648ys1vpf3tzhervv9zzgn", "client_reference_id": "rFdxDcHpD9O3NCHgPXfZA7zTf", "status": "available", "source_id": "fch_01k5649q253tc5shjxw7r841pk", "type": "payment", "test_mode": false } ] } ``` -------------------------------- ### SetupIntent Object Source: https://docs.withflex.com/api-reference/setup-intents/get-setup-intent Represents a SetupIntent object used for collecting payment method details. ```APIDOC ## SetupIntent Object ### Description Represents a SetupIntent object used for collecting payment method details. ### Properties - **setup_intent_id** (string) - The unique identifier for the object. - **client_secret** (string, nullable) - Used for client-side retrieval of the SetupIntent. - **customer** (Expandable_for_Customer, nullable) - The ID of the Customer this SetupIntent belongs to. - **description** (string, nullable) - An arbitrary string attached to the setup intent. - **payment_method** (string, nullable) - Payment method used with this SetupIntent. - **partner_id** (string) - The ID of the Partner associated with this SetupIntent - **metadata** (object) - Set of key-value pairs that you can attach to an object. - **created_at** (Timestamptz) - The time the SetupIntent was created. - **status** (string) - The status of the SetupIntent. - **test_mode** (boolean) - Whether the SetupIntent was created in test mode. - **usage** (string) - Indicates the intended usage of the SetupIntent. ### Example ```json { "setup_intent_id": "seti_01HACM7FZ1084XB1GB6053VM0D", "client_secret": "seti_01HACM7FZ1084XB1GB6053VM0D_secret_...", "customer": "cus_01HACM7FZ1084XB1GB6053VM0D", "description": "Monthly subscription setup", "payment_method": "pm_card_visa", "partner_id": "part_01HACM7FZ1084XB1GB6053VM0D", "metadata": { "order_id": "ord_12345" }, "created_at": "2023-10-27T10:00:00Z", "status": "requires_payment_method", "test_mode": false, "usage": "off_session" } ``` ``` -------------------------------- ### Simulating Invalid Data for Errors Source: https://docs.withflex.com/developer-guides/integration/test-mode This guide explains how to trigger errors by inputting invalid data for payment processing. It provides examples for invalid expiration months, years, CVC codes, and ZIP codes. This is useful for testing the error handling capabilities of the system. ```plaintext **Invalid expiration month:** Enter a non-existent month, such as 13. **Invalid expiration year:** Use a year that is more than 50 years in the past, such as 99. **Invalid CVC:** Enter a two-digit code, like 88. **Invalid ZIP:** Enter a four-digit zip code, like 1234. ``` -------------------------------- ### Customer Object Source: https://docs.withflex.com/api-reference/setup-intents/get-setup-intent Represents a customer resource with their associated details. ```APIDOC ## Customer Object ### Description Represents a customer resource with their associated details. ### Properties - **customer_id** (string) - The unique identifier for the customer. - **first_name** (string) - The customer's first name. - **last_name** (string) - The customer's last name. - **email** (string) - The customer's email address. - **phone** (string, nullable) - The customer's phone number. - **employer** (string, nullable) - The customer's employer. - **shipping** (ShippingAddress, nullable) - The customer's shipping address. - **metadata** (object, nullable) - Metadata associated with the customer. - **created_at** (Timestamptz) - The time the customer was created. - **test_mode** (boolean) - Whether the customer was created in test mode. ### Example ```json { "customer_id": "fcus_01HACM7FZ1084XB1GB6053VM0D", "first_name": "John", "last_name": "Doe", "email": "joh.doe@example.com", "phone": "+15555555555", "employer": "Flex", "shipping": { "shipping_address_id": "shadd_01HACM7FZ1084XB1GB6053VM0D", "line1": "123 Main St", "line2": null, "city": "Anytown", "state": "CA", "postal_code": "90210", "country": "US" }, "metadata": { "internal_id": "cust_12345" }, "created_at": "2023-10-27T10:00:00Z", "test_mode": false } ``` ``` -------------------------------- ### Example Flex API Checkout Session Response (JSON) Source: https://docs.withflex.com/developer-guides/integration/shopify/reconciliation This is an example JSON response from the Flex API when retrieving checkout session details. It includes information about the order, customer, payment intent, and transaction status. This data can be used for reconciliation purposes in systems like NetSuite. ```json { "checkout_sessions": [ { "allow_promotion_codes": false, "amount_total": 2399, "amount_subtotal": 2399, "cancel_url": null, "capture_method": "automatic", "checkout_session_id": "fcs_01J4J810XTHBS172KC6SMNVGMW", "client_reference_id": "footy", "created_at": 1722894287, "customer": { "customer_id": "fcus_01J4J81HEVYJRWQKCCD6Z2J6BR", "first_name": "John", "last_name": "doe", "email": "john@doe.com", "phone": "+15555555555", "employer": null, "shipping": null, "created_at": "2024-08-05T21:45:04.732046Z", "test_mode": true }, "defaults": null, "expires_at": 1722897887, "invoice": null, "hsa_fsa_eligible": true, "letter_of_medical_necessity_required": false, "metadata": null, "mode": "payment", "payment_intent": { "payment_intent_id": "fpi_01J4J824CM51EW8F9Z7YW8J79Y", "amount": 2399, "customer": { "customer_id": "fcus_01J4J81HEVYJRWQKCCD6Z2J6BR", "first_name": "miguel", "last_name": "toledo", "email": "miguel@lol.com", "phone": "+16784283034", "employer": null, "shipping": null, "created_at": "2024-08-05T21:45:04.732046Z", "test_mode": true }, "transfer_data": { "amount": 2328, "destination": "facct_b8b56d3f3ba09d6c5dc61f7916e03ae3" }, "status": "succeeded", "latest_charge": null, "created_at": "2024-08-05T21:45:24.119005Z", "invoice": null, "capture_method": "automatic", "client_secret": null, "metadata": null, "test_mode": false }, "redirect_url": "https://checkout.withflex.com/pay/c/fcs_01J4J810XTHBS172KC6SMNVGMW", "setup_intent": null, "shipping_options": null, "shipping_address_collection": false, "shipping_details": null, "status": "complete", "success_url": "https://exaple.test/success", "subscription_id": null, "tax_rate": null, "test_mode": true, "total_details": { "amount_discount": 0, "amount_tax": null, "amount_shipping": null, "amount_iias": 2399 }, "visit_type": null } ] } ``` -------------------------------- ### Create Product Source: https://docs.withflex.com/developer-guides/integration/checkout/quick-start Create a new product to sell through Flex Checkout. Sensitive information like price should be managed server-side. ```APIDOC ## POST /v1/products ### Description Creates a new product with details such as name, description, and eligibility. ### Method POST ### Endpoint /v1/products ### Parameters #### Request Body - **product** (object) - Required - The product object containing product details. - **name** (string) - Required - The name of the product. - **description** (string) - Optional - A description of the product. - **visit_type** (string) - Required - The type of visit associated with the product (e.g., 'gym'). - **hsa_fsa_eligibility** (string) - Optional - HSA/FSA eligibility status (e.g., 'letter_of_medical_necessity'). ### Request Example ```json { "product": { "name": "Test Product", "description": "Test Product Description", "visit_type": "gym", "hsa_fsa_eligibility": "letter_of_medical_necessity" } } ``` ### Response #### Success Response (200) - **product** (object) - The created product object. - **product_id** (string) - The unique identifier for the product. - **name** (string) - The name of the product. - **description** (string) - The description of the product. - **created_at** (string) - Timestamp of creation. - **visit_type** (string) - The type of visit. - **active** (boolean) - Indicates if the product is active. - **hsa_fsa_eligibility** (string) - HSA/FSA eligibility status. #### Response Example ```json { "product": { "product_id": "fprod_01HW5MXAPBE79RHMMJJGB4ACAB", "name": "Test Product", "description": "Test Product Description", "created_at": "2024-04-23T14:14:16.029253Z", "visit_type": "gym", "active": true, "hsa_fsa_eligibility": "letter_of_medical_necessity" } } ``` ``` -------------------------------- ### Flex Checkout Session Generation Response Source: https://docs.withflex.com/developer-guides/integration/checkout/quick-start Example JSON response after generating a checkout session. It provides a `redirect_url` that users should be directed to for completing their payment. ```json { "checkout_session": { "redirect_url": "https://checkout.withflex.com/pay/c/fcs_01HW5Q2A08N6A0YGZ6T1KARN8S", … } } ``` -------------------------------- ### SetupIntent Object Structure Source: https://docs.withflex.com/api-reference/setup-intents/get-setup-intent This section details the fields available within the SetupIntent object, including descriptions, data types, and references to other schema components. ```APIDOC ## SetupIntent Object ### Description Represents an object used for storing additional information about a payment method for future use. ### Properties - **id** (string) - Required - Unique identifier for the SetupIntent. - **object** (string) - Required - The type of the object, always 'setup_intent'. - **application** (object) - Optional - Details about the application associated with the SetupIntent. - **additionalProperties** (object) - Allows for arbitrary additional properties of type object. - **client_secret** (string) - Optional - The client secret for the SetupIntent, used for client-side operations. - **created_at** (Timestamptz) - Required - The time at which the object was created, in ISO 8601 format. - **livemode** (boolean) - Required - Whether the SetupIntent is in live mode. - **object** (string) - Required - The type of the object, always 'setup_intent'. - **payment_method_options** (object) - Optional - Configuration for payment method options. - **additionalProperties** (object) - Allows for arbitrary additional properties of type object. - **payment_method_types** (array) - Required - List of payment method types eligible for this SetupIntent. - items (string) - **status** (Status2) - Required - The current status of the SetupIntent. - **usage** (Usage) - Required - Indicates how the payment method is intended to be used in the future. ### Status Enum (Status2) - **requires_payment_method** - **requires_confirmation** - **requires_action** - **processing** - **succeeded** - **canceled** ### Usage Enum (Usage) - **off_session** - **on_session ```