1. Home
  2. Interswitch lending Service
  3. Value Financing
  4. Lending Service Hosted Fields

Lending Service Hosted Fields

This provides a way for merchant channels to securely collect card details for customers paying with credit on their channels. It enables the merchant to control the experience and look and feel. This is supposed to be used in conjunction with the Get Tenured Offers API and the target is web merchants

The following fields are hosted securely in iframes which the merchant can embed in their checkout page;

  1. PAN
  2. Expiry Date
  3. PIN
  4. CVV

Step-by-step guide

For the duration of this guide, we will be using the form below.

Card form

 

Load the SDK.
  1. Load javascript sdk

    Loading the SDK will make available a global interswitch.hostedFields variable available.

  2. Create a hosted field instance calling the newInstance method on the interswitch.hostedFields variable. The method takes options and a callback. An hosted field instance which can be used to register events listeners and finally submit the customer’s request when the customer clicks on a the submit button will be returned to the callback
    Create Hosted Fields Instance
      function (err, hostedFieldInstance) {
        if (err) {
          // something is wrong,
          return;
        }
        function findLabel(field) {
          return $('.hosted-field--label[for="' field.container.id + '"]');
        }
        hostedFieldInstance.on('focus'function (event) {
          var field = event.fields[event.emittedBy];
          findLabel(field).addClass('label-float').removeClass('filled');
        })
      })

    The options include authorization, accept offer request, fields and styles as shown below.

    Available Options
    var options = {
      request: {
        channelCode: "QTUSSD",
        customerId: "2348030583962",
        offerId: "OFFER1529932588104",
        providerCode: "MKT",
        merchantCode: "VNA"
      },
      styles: {
        'input': {
          'font-size''16px',
          'font-family''roboto, verdana, sans-serif',
          'color''black'
        },
        ':focus': {
          'color''blue'
        },
        '.valid': {
          'color''black'
        },
        '.invalid': {
          'color''red'
        }
      },
      fields: {
        pan: {
          selector: '#card-pan',
          placeholder: '1111 1111 1111 1111'
        },
        cvv: {
          selector: '#card-cvv',
          placeholder: '111'
        },
        exp: {
          selector: '#expiration-date',
          placeholder: 'MM/YY'
        },
        pin: {
          selector: '#card-pin',
          placeholder: 'PIN'
        }
      }
    }
  3. As soon as the customer submits, initiate a submit request on the hostedFieldInstance returned in 2.
    Submit Loan Application
    var submit = document.querySelector('button[type="submit"]');
    submit.addEventListener('click'function (evt) {
      hostedFieldInstance.submit(function (err, payload) {
        if (err) {
          alert("Loan application failed");
          return;
        }
        else {
          var payref = payload.body.loanId;
          alert("Loan application was successful with loan Id of " + payref);
          return;
        }
      });
    }, false)

 

Was this article helpful to you? Yes No

How can we help?