Create a ForageEbtBalanceElement
ForageEbtBalanceElement
forage.create('ebt_pin_check_balance')
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
Type | Description | |
---|---|---|
ebt_pin_check_balance required | string | The constant string ebt_pin_check_balance . |
Example
const ebtBalanceElement = forage.create('ebt_pin_check_balance')
After creating the
EBT Element
, call themount()
method to attach it to the DOM. Refer to theEBT Element
lifecycle for more details.
Submit a ForageEbtBalanceElement
ForageEbtBalanceElement
forage.createEbtPinBalanceCheck(ForageEbtBalanceElement, paymentMethodRef)
forage.createEbtPinBalanceCheck(ForageEbtBalanceElement, paymentMethodRef)
This Forage method executes a balance check.
Parameters
Type | Description | |
---|---|---|
ForageEbtBalanceElement required | object | The object created in response to calling the method that creates a balance check element. |
paymentMethodRef required | string | A 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:
Type | Description | |
---|---|---|
snap | string | The available SNAP balance on the customer’s EBT Card, represented as a numeric string. |
non_snap | string | The available EBT Cash balance left on the EBT Card, represented as a numeric string. |
updated | ISO 8601 date-time string | The 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.