Skip to main content
The Ingo Instant Payments SDK is a JavaScript library that mounts the iFrame inside your web application. Include it via a <script> tag and use the three methods below to initialize, mount, and respond to the hosted account capture flow.
<script type="text/javascript"
  src="/path/to/ingo.instantpayments.clientsdk_v2.0.js">
</script>

Methods

IngoInstantPayments.create(domElement, options?)

Creates an instance of the SDK and attaches it to a DOM element in your page. Returns a webPlugin object that exposes the mount and addEventListener methods. Arguments
ArgumentRequiredTypeDescription
domElementYesElement or stringThe DOM element or CSS selector where the iFrame will be injected (e.g. document.getElementById("container") or "#container").
optionsNoObjectInitialization options (see below).
Options
OptionTypeDefaultDescription
cssNamestringA CSS class name to add to the iFrame element.
autoHeightbooleanfalseWhen true, the iFrame height adjusts automatically as its content changes or the window is resized.
scrollingbooleanfalseEnables or disables the iFrame’s default scroll bars.
var webPlugin = IngoInstantPayments.create(
  document.getElementById("container"),
  {
    cssName: "web-plugin",
    autoHeight: true,
    scrolling: false
  }
);

webPlugin.mount(authorizedUrl, fundingDestination)

Mounts the iFrame and launches the account capture flow for the specified funding destination. Must be called after create(). Arguments
ArgumentRequiredTypeDescription
authorizedUrlYesstringThe authorized_url returned from the Session Create API. Valid for 30 seconds after creation.
fundingDestinationYesConstantThe account type to tokenize. Must be a valid IngoInstantPayments.FUNDING_DESTINATIONS value.
FUNDING_DESTINATIONS constants
ConstantPayment Type
IngoInstantPayments.FUNDING_DESTINATIONS.DEBITDebit card
IngoInstantPayments.FUNDING_DESTINATIONS.CREDITCredit card
IngoInstantPayments.FUNDING_DESTINATIONS.ACHBank account (ACH)
IngoInstantPayments.FUNDING_DESTINATIONS.BILLPAYBillPay
IngoInstantPayments.FUNDING_DESTINATIONS.PAYPALPayPal
webPlugin.mount(
  authorized_url,
  IngoInstantPayments.FUNDING_DESTINATIONS.DEBIT
);

webPlugin.addEventListener(event, handler)

Registers a callback function for a specific SDK event. This is the only way to receive data from the iFrame. Register listeners before or immediately after calling mount(). Arguments
ArgumentRequiredTypeDescription
eventYesConstantThe event to listen for. Must be a valid IngoInstantPayments.EVENTS value.
handlerYesfunctionCallback invoked when the event fires. Receives an event data object.
Common event payload fields Every event payload includes at minimum:
FieldDescription
session_identifierUnique identifier for the current session.
tracer_tokenToken used for debugging across systems.
event_nameName of the event fired (e.g. iip.webplugin.token_success).
Additional fields are event-specific. See SDK Events for the full payload reference per event.
webPlugin.addEventListener(
  IngoInstantPayments.EVENTS.TOKEN_SUCCESS,
  function(data) {
    var token = data.customer_account_token;
    // use token with IngoPay process API
  }
);

webPlugin.addEventListener(
  IngoInstantPayments.EVENTS.PAGE_LOAD,
  function(data) {
    console.log(data.content.page); // e.g. "DebitFunding"
  }
);