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

# Reconciliation

> Understand money movement from Flex with your Shopify Store.

Reconciliation will vary depending on how you organize your books. Flex provides you with all the data to ensure you are able to reconciliate your shopify data without a problem.

## How money flows

First, let's make sure we understand how money reaches your bank account.

Flex uses Stripe to handle payouts directly to your bank account. As part of the onboarding process, you'll set up a stripe account and link your bank account to receive payments.

When a customer transacts on your shopify store:

1. Flex will process the payment
2. An order is generated in your Shopify Admin with a payment id
3. The payment amount minus the Flex fees will go to your stripe account
4. Within 24-72 hours the funds will settle and be in your bank account

## Retrieving data from Flex

<Note>
  An order in shopify is still created with all the order and customer details
  like any other shopify order. The only difference is the payment gateway will
  appear as "Flex"
</Note>

If your team is used working with spreadsheets, the transactions export in the Flex dashboard should have all the information you need.

If your team has automated this process and uses a system such as NetSuite, you can leverage our API's to pull the necessary information.

To do so you can use the payment id that belongs to the Shopify Order as the `client_reference_id` to query for the corresponding checkout session.

1. Generate an API Key in the Flex Dashboard to query the Flex API
2. When a Shopify Order gets generated retrieve the payment id
3. Use the payment id to query the Flex API

Example Request:

```bash theme={null}
curl --request GET \
  --url 'https://api.withflex.com/v1/checkout/sessions?client_reference_id=<shopify_payment_id>&expand_payment_intent=true&expand_customer=true' \
  --header 'authorization: Bearer fsk_test_ODg1NmY3Y2MtYTVmZS00MGM0LWExNWMtNjViODZjNTI4Yzdl' \
  --header 'content-type: application/json'
```

Example Response:

```json theme={null}
{
  "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
    }
  ]
}

```

4. Push relevant data as needed to your NetSuite or any other similar system.

If there is any information missing or run into any issues with reconciliation, you can always reach out to your Flex representative to assist!

<Card title="Install the Flex Marketing App" icon="shopping-bag" href="/merchant-success/overview/shopify-marketing" horizontal>
  Promote HSA/FSA across your storefront with dynamic badges, a prebuilt landing page, and product eligibility synced from Flex.
</Card>
