Documentation Index

Fetch the complete documentation index at: https://developer.upgrade.com/llms.txt

Use this file to discover all available pages before exploring further.

Confirming a Flex Pay Booking

Prev Next

Once a virtual payment card has been processed and the booking has been confirmed by you, a call containing a confirmation number for the booking must be sent to Flex Pay's API. This call informs Flex Pay that the booking was successfully completed and allows Flex Pay to provide a better customer service experience for all customers, as it will be used as a reference by Flex Pay's customer support representatives.

val orderConfirmationCallback = object : OrderConfirmationCallback {
    override fun onSuccess() {
        // Callback method which is called when a successful confirmation has happened.
    }
    override fun onError(error: ULError) {
        // Callback method which is called when an error has happened during the confirmation.
    }
}
runCatching {
    ULOrderManager.getInstance().orderSuccessWithId(
        confirmationId = UUID.randomUUID().toString(),
        orderConfirmationCallback = orderConfirmationCallback
    )
}.onFailure {
    Log.d("UpliftSDK", "SDK has not been initialized properly.")
}

Should an error occur in your system that prevents a traveler from successfully booking a trip and/or receiving a confirmation, a brief, human-friendly message describing the error that occurred must be passed to the API. This will be used as a reference by Flex Pay's customer support representatives also.

val error = ULOrderError(
    type = ULOrderErrorType.ULOrderErrorTypePayment,
    message = "Something went wrong!"
)
val orderConfirmationCallback = object : OrderConfirmationCallback {
    override fun onSuccess() {
        // Callback method which is called when a successful confirmation has happened.
    }
    override fun onError(error: ULError) {
        // Callback method which is called when an error has happened during the confirmation.
    }
}
runCatching {
    ULOrderManager.getInstance().orderFailWithErrors(
        error = error,
        orderConfirmationCallback = orderConfirmationCallback
    )
}.onFailure {
    Log.d("UpliftSDK", "SDK has not been initialized properly.")
}

Deleting an Order

The purpose of the deleteOrder method is to reset an already active checkout session. While it is not mandatory, it can be useful to call this method in cases of successful payment, canceled payment, or payment error to ensure that all previous checkout data is cleared from the cache.

runCatching {
    ULOrderManager.getInstance().deleteOrder()
}.onFailure {
    Log.d("UpliftSDK", "SDK has not been initialized properly.")
}