Introduction to the Flex API
Learn the basics of integrating with the Flex API to accept HSA/FSA payments
The Flex API allows you to integrate HSA/FSA payment capabilities directly into your application. This guide covers the basics of how to get started with the API, authentication, and core concepts.
Authentication
All API requests must include your API key in the Authorization header:
Always keep your API keys secure and never expose them in client-side code. You can generate and manage API keys in the Partner Dashboard.
Base URL
All API requests should be made to the following base URL:
Content type
API requests with a request body should specify the content type:
Test mode
Flex provides a test mode environment that allows you to test your integration without processing real payments. Test mode API keys start with fsk_test_
, while production API keys start with fsk_
.
Be sure to replace your test API keys with production keys when you’re ready to go live.
API response format
All API responses are returned in JSON format. Successful responses will include the requested resource(s), while error responses will include an error code and message.
Example successful response:
Example error response:
Rate limits
The Flex API enforces rate limits to ensure stability. If you exceed the rate limit, you’ll receive a 429 Too Many Requests
response. The response headers will include information about when you can retry.
Core resources
The Flex API is organized around these core resources:
Resource | Description |
---|---|
Products | What you’re selling (goods or services) |
Prices | How much and how often to charge for products |
Checkout Sessions | A session representing a purchase attempt |
Customers | The buyers of your products |
Payment Intents | The intent to make a payment |
Subscriptions | Recurring payment arrangements |
Next steps
Explore these guides to learn more about specific aspects of the Flex API:
For a complete reference of all API endpoints, see the API Reference section.