Loans SDK integration guides

This document lists the key steps required to launch all SDK flows.

Integration steps


SDK Interface

class ScLoan {
  constructor({ gatewayName }) {}

  // LOS — triggers a new loan origination journey
  apply({ interactionToken }) {}

  // LMS — opens the repayment flow
  pay({ interactionToken }) {}

  // LMS — opens the principal withdrawal flow
  withdraw({ interactionToken }) {}

  // LMS — renders the loan dashboard inside a target DOM element
  // Returns { close: () => Promise, task: Promise }
  // `target` is the DOM element ID to inject the iframe into
  service({ interactionToken, target }) {}
}

Error codes

All Loans SDK methods return an error object of shape { code, message, data? } when the user's intended action isn't completed.

Error codeError messageReason
1012user_cancelledThe user aborted the flow by closing/abandoning the UI
1031contact_supportThe user tapped the contact/support icon - redirect them to your support page or chat
1032missing_permissionsThe user denied the browser permissions needed to continue
1033topup_triggeredThe top-up flow needs to be opened outside the SDK - launch it from your app
1034renewal_triggeredThe renewal flow needs to be opened outside the SDK - launch it from your app
2000internal_error
2001missing_url_params
2002session_invalidThe session no longer exists - restart the interaction with a freshly issued token
3001existing_loan_found
3002phone_already_usedThe phone number is already used by another account
3003loan_offer_expiredThe loan offer given to the user is no longer valid
3004init_sdkAn SDK method was called before setup() completed successfully - call setup() first
3005application_not_approvedThe user's application is not approved
3006application_inactiveThe user's application is inactive
3007name_mismatch_brokerThe name on the broker account does not match the name from KYC
3008not_eligible_for_loanThe user is not eligible for the loan (eligibility check or customer acceptance failed)
3009verification_pendingVideo KYC verification must be completed before the user can move forward
4000invalid_request
4001partner_inactive
4002guest_not_allowed
4003interaction_expired
4004invalid_intent
4005invalid_interaction
4006invalid_intent_config
4007api_secret_mismatch
4008invalid_auth_token
4009dashboard_already_openservice() was called while a dashboard is already open
4010element_not_foundThe target DOM element ID passed to service() was not found
📘

Refer - How to call Unity API and how to create interaction token?



Did this page help you?