- 28 Apr 2025
- 5 Minutes to read
- DarkLight
Payment Status
- Updated on 28 Apr 2025
- 5 Minutes to read
- DarkLight
Flex Pay Web API Integration (Payments)
Note: This is exclusive to the Flex Pay Web API Integration (Payments) product. Please contact your account manager for more information on this product.
The table below provides guidance regarding when certain elements in the Flex Pay Web API Integration should be enabled/shown on your website during the checkout process based on the response provided by Flex Pay integration in the Callback handler as the customer completes their payment application.
Additionally, the last column of the table (Token sent) describes key information for when the token is available in order for you to charge the virtual card.
Status | Show Payment Selectors | Enable Pay Monthly Option | Enable the Purchase/Booking Button | Token Sent |
---|---|---|---|---|
OFFER_AVAILABLE Offer is available to the customer, waiting for user to complete application flow | YES | YES. Show monthly pricing in the selector and hide NOT AVAILABLE node | NO | NO |
TOKEN_AVAILABLE Flex Pay is ready to pay partner and token is available to be retrieved when user clicks booking button by calling getToken method | YES | YES | YES | |
TOKEN_RETRIEVED Flex Pay token is retrieved and available to developer | YES | YES | YES. User will most likely go to the Confirmation page, once the booking button is clicked following your standard checkout flow | YES |
OFFER_UNAVAILABLE Offer is not available and reason codes are provided | YES | NO. Show the NOT AVAILABLE node in the selector and hide monthly pricing. | n/a | n/a |
SERVICE_UNAVAILABLE Something is wrong with the system | No. Proceed with booking flow without Flex Pay | n/a | n/a | n/a |
⚠️ Once you retrieve the token and have the virtual card information available, you must then charge the virtual card as you would any other credit card in order to complete the transaction.
⚠️ Please note, these statuses do not always follow a specific order. For example, after TOKEN_AVAILABLE
is returned it is not guaranteed that TOKEN_RETRIEVED
is the next status.
Using this information, we have provided a template of the updated callback handler for your reference below, complete with the expected responses and actions as the customer completes their Flex Pay application and the corresponding payment process.
function myOnChangeCallback(response) {
var statusHandlers = {
OFFER_AVAILABLE: function(){
// STATUS: Flex Pay Offer is available for this orderInfo
// 1. show payment selectors
// 2. show monthly pricing node in the selector
// 3. hide "NOT AVAILABLE" node in the selector
// 4. enable Pay Monthly selector
// 5. disable Purchase/Book button
},
TOKEN_AVAILABLE: function(){
// STATUS: Flex Pay application has been completed and Flex Pay is ready to pay
// 1. show payment selectors
// 2. enable Pay Monthly selector
// 3. enable Purchase/Book button
// 4. retrieve the token ONLY AFTER Purchase/Book button is clicked
// using: window.Uplift.Payments.getToken();
// The virtual card should be retrieved when user clicks the Purchase/Book button
},
TOKEN_RETRIEVED: function(){
// STATUS: Token is available to be charged for payment
// Flex Pay Payment Token successfully retrieved.
// 1. utilize the retrieved token (virtual card) to pay in full by Flex Pay.
},
OFFER_UNAVAILABLE: function(){
// STATUS: Pay monthly offer is unavailable for this orderInfo
// 1. show payment selectors
// 2. show "NOT AVAILABLE" node in the selector
// 3. hide monthly pricing node in the selector
// 4. disable Pay Monthly selector
// 5. change payment option selection, if Pay Monthly option is selected
},
SERVICE_UNAVAILABLE: function(){
// STATUS: Flex Pay API is unavailable
// 1. do not show payment selectors
}
};
statusHandlers[response.status]();
}
Flex Pay Agent Connect
Note: This is exclusive to the Flex Pay Agent Connect product. Please contact your account manager for more information on this product.
The table below provides guidance regarding when certain elements in the Flex Pay Agent Connect should be enabled/shown on your website during the checkout process based on the response provided by Flex Pay integration in the callback handler as the customer completes their payment application.
Additionally, the last column of the table (Token sent) describes key information for when the token is available in order for you to charge the virtual card.
Status | Show Payment Selectors | Enable Pay Monthly Option | Enable the Booking Button | Token Sent |
---|---|---|---|---|
OFFER_AVAILABLE Offer is available to the customer, waiting for user to complete application flow | YES | YES. Show monthly pricing in the selector and hide NOT AVAILABLE node | NO | NO |
TOKEN_AVAILABLE Flex Pay is ready to pay partner and token is available when user clicks booking button by calling getToken method | YES | YES | YES | NO. The token should be retrieved when user clicks on the booking/ purchase button on your site |
TOKEN_RETRIEVED Flex Pay token is retrieved and available to developer | YES | YES | YES. User will most likely go to the Confirmation page, once the booking button is clicked following your standard checkout flow | YES |
OFFER_UNAVAILABLE Offer is not available and reason codes are provided | YES | NO. Show the NOT AVAILABLE node in the selector and hide monthly pricing. | n/a | n/a |
SERVICE_UNAVAILABLE Something is wrong with the system | No. Proceed with booking flow without Flex Pay | n/a | n/a | n/a |
⚠️ Once you retrieve the token and have the virtual card information available, you must then charge the virtual card as you would any other credit card in order to complete the transaction.
Using this information, we have provided a template of the updated callback handler for your reference below, complete with the expected responses and actions as the agent's client completes their Flex Pay application and the corresponding payment process.
function myOnChangeHandler(response) {
var statusHandlers = {
OFFER_AVAILABLE: function() {
// STATUS: Flex Pay offer is available
// 1. show and enable payment selectors
// 2. disable Purchase/Book button
// 3. show monthly pricing (from response) in the selector
// Note: the pricing is in minor units (cents)
// 4. store tripId (if exists) returned in response
// 5. show disclaimer text (from response) using tool tip UI
const {offer, tripId} = response;
const {disclaimerText, monthlyPaymentAmount} = offer;
},
TOKEN_AVAILABLE: function() {
// STATUS: Flex Pay is ready to pay, guest confirmed for loan
// 1. show and enable payment selectors
// 2. enable Purchase/Book button
// 3. retrieve the token (.getToken()) after book button click
},
TOKEN_RETRIEVED: function() {
// STATUS: Token is available to be charged for payment
const {token} = response;
},
OFFER_UNAVAILABLE: function() {
// STATUS: Pay monthly offer is unavailable for this client
// 1. show and disable payment selectors
// 2. show "NOT AVAILABLE" messaging in the selector
// 3. hide monthly pricing node in the selector
// 4. clear any existing tripId for this session (response will be null)
},
SERVICE_UNAVAILABLE: function() {
// STATUS: Flex Pay API is unavailable
// 1. do not show payment selectors
}
};
statusHandlers[response.status]();
}