Introduction
There are two key steps that must be taken in order for off session checkouts with a product requiring a Letter of Medical Necessity to work as intended:- Having the customer complete the initial (on session) checkout session
- Using the customer’s off-session-verified payment method (along with their
customer_id) from step 1 in subsequent off session checkouts
Initial (On Session) Checkout Session
This step is vital to ensure all future off session payments work. During the initial on session checkout, the customer will:- Go through the checkout consultation to determine if they are eligible to receive a Letter of Medical Necessity for the product(s) in the checkout.
- Provide a valid payment method that will then be verified for future off session payments (assuming the payment is successful).
- Be assigned a Flex
customer_id(if they are a customer using Flex for the first time; if they have used Flex prior they will already have this).
Example On Session Checkout Creation
The key difference here compared to other checkouts is making sure you set thesetup_future_use parameter to off_session. This is how Flex knows to validate the payment method used in the checkout for future off session payments.
- A valid Letter for the product (Flex will use this valid letter as part of the process when determining if future off session payments can go through)
- A
customer_id - A verified
payment_method
Off Session Checkout Creation
Now that we have access to:- The customer’s
customer_id - The customer’s off session verified
payment_method - A validated Letter attached to the customer for the product
Getting customer_id
Thecustomer_id is a required field for off session checkouts, and is also useful for programmatically finding the customer’s payment method(s).
There are several ways to obtain it:
- Grabbing it from the
checkout.session.completedwebhook event that is fired when the checkout session completes - Using the associated checkout session’s ID with the GET Checkout endpoint, and grabbing it from the returned checkout session object
- Finding it with the List Customers endpoint
- Finding it in the Customers tab of the Flex dashboard
Getting payment_method ID
Now that we have thecustomer_id, we can use the List Payment Methods endpoint to grab the customer’s payment method that is approved for off sessions. You will know if the payment method is viable for off sessions by seeing the off_session field with a value of true on the returned payment method object.
Example Off Session Checkout
Now, to use all of this information to complete an off session payment, plug it into the correct places in the Off Session Checkout call:Additional Information
What happens if the customer does not have a letter for the product?
If you try to submit an off session payment in this scenario, the call will fail with an error response like this:Do letters ever expire once a customer gets one?
Yes, letters remain valid for 1 year from the day the customer goes through the consultation. If you want to use off session payments for longer than that, customers will need to go through the on session flow once per year to maintain a valid letter on file.Will one letter cover a customer for all products?
Not necessarily. Letters are tied to specificvisit_type values, so a letter only applies to products that fall under the same visit_type.
For example, if a customer went through an on session checkout and purchased a product bucketed under the gym visit type, they would then have a valid letter for all products in your catalog that also have a gym visit type. You could use an off session payment immediately for those products without the customer needing to go through the on session flow again.
However, if they wanted to purchase a product under the skincare visit type, the gym letter would not be sufficient. The customer would need to go through another on session checkout consultation to receive a letter for skincare visit type products before off session payments would work.