Step 6: Receive payment
  • 19 Jul 2023
  • 3 Minutes to read
  • Dark
    Light

Step 6: Receive payment

  • Dark
    Light

Article summary

Integration Details

Once, the customer has gone through the Uplift application in the checkout iFrame, there are two potential outcomes:

  1. Adverse action (the customer has not been approved), in such a case:
    1. The iFrame will display a message to the agent suggesting completing the purchase with an alternate payment method since the client is not approved for Uplift’s payment method.
    2. The payment selector will remain enabled, however the user will be unable to continue with the Uplift application.
    3. The callback handler will receive an OFFER_AVAILABLE status due to compliance reasons due to which we are unable to share the specific status of the loan application.
  2. Successful application (the customer has been approved), in such a case:
    1. The callback handler will fire a TOKEN_AVAILABLE status signaling that a token object (containing the details of Uplift virtual card similar to any bank card) is available for the merchant to process your payment.

      However, in order to retrieve the token, you will need to invoke a call using the window.Uplift.Agent.getToken() method. This method does not take any parameter and makes a request to the Uplift platform to send the token object.

      ⚠️ Make sure to obtain the available token ONLY AFTER the user clicks on the booking/purchase button on your website.

    2. Once the token has been sent by Uplift, the callback handler will fire a TOKEN_RETRIEVED status with the token as an attribute of the response. This token object can then be used to process payment similar to any other bank card.

      📘 Detailed attributes of the token and how to get paid using it can be found here.

    Below is an example of the updated callback handler with the above mentioned changes.

    function myOnChangeCallback(response) {
      var statusHandlers = {
        OFFER_AVAILABLE: function(){
          //Uplift Pay Monthly Offer available for this customer.
        },
        TOKEN_AVAILABLE: function(){
          //Uplift application has been completed and ready to pay in full.
          window.Uplift.Agent.getToken();
        },
        TOKEN_RETRIEVED: function(){
          //Uplift Payment Token successfully retrieved.
          var token = response.token;
          //process payment using token (uplift virtual card).
        },
        OFFER_UNAVAILABLE: function(){
         //Uplift Pay Monthly Offer is not available for this customer.
        },
        SERVICE_UNAVAILABLE: function(){
          //Uplift Payments Service is unavailable.
        }
      };
      statusHandlers[response.status]();
    }
    

Error Reporting

⚠️ If an error occurred while processing payment with the Uplift token that prevented a user from successfully booking or completing a purchase, please report it to Uplift using the following method:

window.Uplift.Agent.error(tripId: String, type: String, message: String)

window.Uplift.Agent.error(tripId: String, type: String, message: String)

This method has three parameters, tripId representing the identifier for the trip object for which the error occurred, type which has four possible values (missing_data, payment, inventory, fatal) corresponding to the type of error and message representing the message shown to the user.

Below is the definition of each type value:

  1. missing_data - issue with validation on booking platform.
  2. payment - problem with payment processor or authentication/token failure.
  3. inventory - current booking is no longer available or is sold out.
  4. fatal - lost session or any unknown error that does not fit in any of the categories above.

Reporting errors will help Uplift improve and better serve our mutual customers.

Processing Confirmation

If your (merchant) payment was successfully processed using the Uplift token, then the tripId and confirmationIds should be sent to Uplift using the method below.

window.Uplift.Agent.confirmTrip(tripId: String, confirmationId: [String])

This method informs Uplift that the booking was successful and allows us to provide a better customer experience for our mutual customers, in case they call Uplift.

📘 Since certain partners provide confirmation on the same payment page while others have a separate confirmation page, before sending the confirmation number, please validate that you have already loaded the up.js code, defined the window.upReady and initialized the library using initPayMonthly as explained in step 2.

Processing Cancellation

In case the current agent’s session associated with the given tripId is terminated, or the agent has booked using an alternative form of method, Uplift should be notified of this using the method shown below ensuring to provide the corresponding tripId.

window.Uplift.Agent.cancelTrip(tripId: String)

Once you call this method, the given tripId will no longer be valid and it is no longer necessary to store/track it anymore.


Was this article helpful?