Subscriptions
Learn how to create and manage recurring HSA/FSA payments through Flex.
Create and manage subscriptions with Flex
Flex supports subscriptions for Checkout Sessions and Payment Links allowing customers to use their HSA/FSA for recurring purchases.
This is currently only supported for products that are eligible through a Letter of Medical Necessity.
The Letter of Medical Necessity is valid for 12 months and will only be issued when the customer first started the transaction for the subscription. After the 12 months, the customer will need to be approved for another Letter of Medical Necessity. Flex will inform the user that their Letter is set to expire and will follow up with the customer.
How subscriptions work
With subscriptions, customers can use their HSA/FSA to make recurring payments for access to a product.
Subscription entities
Use the following resources to build and manage subscriptions
Resource | Definition |
---|---|
Product | What your business offers |
Price | How much and how often to charge for products. |
Customer | The customer that a subscription belongs to |
Subscription | The product details associated with the plan that your customer subscribes to. |
Invoice | A statement of amounts owed by a customer. Every time a customer needs to be charged for their subscription, an invoice get generated |
Payment Intent | The payment that corresponds to an invoice |
Integration example
Here we’ll walk through the steps that happen creating a subscription on Flex.
Your website
On your website customers have either added items to their cart or specified the plan they would like to purchase. They are presented with a “Pay with HSA/FSA” button. Upon selecting the option your application will interact with the Flex API server to create a checkout session.
Ensure you have passed the appropriate prices that match the amount and cadence you’d like to charge for your subscription. Learn more about products and prices here.
Flex hosted checkout page
Upon being redirected the customer will enter their payment details. Flex will create a subscription that by default
will have the status of incomplete
. Once the payment has been approved the subscription will transition to active
.
Along with a subscription being created, an invoice for the first payment will be created and a payment intent that
corresponds to that specific invoice.
Upon successful payment, the customer will be redirected to the redirect URL specified as part of the checkout session request.
Provisioning
After a successful payment, you can safely provision the product for the customer. This generally means:
- Verifying the checkout session was completed.
- Verifying the status of the subscription is active.
- Granting the customer access. This can mean shipping a physical good, unlocking an access code, or notifying the customer.
Recurring charges
Flex will handle charging the customer’s HSA/FSA card for you automatically. Each charge will have its own corresponding invoice and payment intent. If the payment fails you can listen to webhooks to monitor the status of the subscription and decide what would be the best action.
Handling recurring charge failures
To manage failures, set up a webhook and listen to the customer.subscription.updated event so that you’re notified when subscriptions
enter a past_due
state.
From here, you can email the client to request an alternative payment method.
The subscription lifecycle
The following is the lifecycle of a subscription as customer checks out with Flex.
- When a subscription gets created. The subscription is of status
incomplete
. - An invoice for the subscription gets created. The status of the invoice is
open
. - Customer successfully pays using their HSA/FSA
- When the payment succeeds
- The subscription status moves to
active
- The invoice status is set to
paid
- An
invoice.paid
,checkout_session.completed
,customer.subscription.updated
webhook event gets
- The subscription status moves to
- Provision access to your product
The status can also become trialing
if you offer a trial period. When the trial is over, the
subscription moves to active
and the subscribed customer starts to be charged.