Create a ForageEbtBalanceElement

forage.create('ebt_pin_check_balance')

This Forage method displays an input field that collects a customer’s four-digit EBT Card PIN in order to check the account balance. Forage does not store the PIN.

Returns a ForageEbtBalanceElement that is passed to the submit method to create the balance check.

Parameters

TypeDescription
ebt_pin_check_balance

required

stringThe constant string ebt_pin_check_balance.

Example

const ebtBalanceElement = forage.create('ebt_pin_check_balance')

👍

After creating the EBT Element, call the mount() method to attach it to the DOM. Refer to the EBT Element lifecycle for more details.

Submit a ForageEbtBalanceElement

forage.createEbtPinBalanceCheck(ForageEbtBalanceElement, paymentMethodRef)

This Forage method executes a balance check.

Parameters

TypeDescription
ForageEbtBalanceElement

required

objectThe object created in response to calling the method that creates a balance check element.
paymentMethodRef

required

stringA string identifier that refers to an instance in Forage's database of a PaymentMethod, which is a tokenized representation of an EBT Card.

Example

try {
  const ebtBalanceResult = await forage.createEbtPinBalanceCheck(
    ebtBalanceElement,
    paymentMethodRef
  )
  const { snap, non_snap, updated } = ebtBalanceResult
} catch (forageErr) {
  if (forageErr?.errors?.length) {
    const [error] = forageErr.errors
    // unpack the first error
    const { httpStatusCode, message, code } = error ?? {}
  }
}

Returns

forage.createEbtPinBalanceCheck(ForageEbtBalanceElement, paymentMethodRef) returns a Promise.

On success, the Promise resolves with an object that contains the following fields:

TypeDescription
snapstringThe available SNAP balance on the customer’s EBT Card, represented as a numeric string.
non_snapstringThe available EBT Cash balance left on the EBT Card, represented as a numeric string.
updatedISO 8601 date-time stringThe date-time when the funds in the account last changed.

Example return value

{
    snap: '100',
    non_snap: '100',
    updated: '2021-06-16T00:11:50.000000Z-07:00'
}

Enable a "Submit" button for customer input

Find an example submit function in the Forage JS quickstart, and listen for the "change" event’s complete value to enable the button as in this snippet.

⚠️ Allow customers to progress on their own. Do not use complete to automatically perform an action like submitting the form or advancing the cursor to the next input field.

If the EBT balance check fails, then the Promise rejects with a ForageError object that describes the failure.