onApplicationCreated

The event fires when the ChargeAfter Modal is opened and applicationId is created.

The applicationId is a session-tracking ID for the consumer journey on ChargeAfter.

It can be used to create a sessionToken to continue a flow from Apply to Checkout, or to resume the flow if the consumer dropped for some reason in the middle.

Code samples

function onApplicationCreated(applicationId){
  // do something with the applicationId 
  // can be saved in cache/store/DB etc... for later usage based on needs 
}

// can be sent in Checkout/Apply flows or on a global config

// Apply
ChargeAfter.payments.present('apply', {..., onApplicationCreated});

// Checkout
ChargeAfter.payments.present('checkout', {..., onApplicationCreated});

// Global
// will be fired for Apply and Checkout
// if this is sent and the one on present both will be fired
var config = {
 ...,
 onApplicationCreated
}
const onApplicationCreated = (applicationId: string) => {
  // ... do something with the applicationId 
  // can be saved in cache/store/DB etc... for later usage based on needs 
}

// can be sent in Checkout/Apply flows or on a global config

// Apply
ChargeAfter.payments.present('apply', {..., onApplicationCreated});

// Checkout
ChargeAfter.payments.present('checkout', {..., onApplicationCreated});

// Global
// will be fired for Apply and Checkout
// if this is sent and the one on present both will be fired
const config = {
 ...,
 onApplicationCreated
}