Store an EBT Card

Create a ForageEbtCardNumberElement

forage.create('ebt_card_tokenize_number')

This Forage method displays an input field that collects a customer’s EBT Card number, also known as their Personal Account Number (PAN), in order to tokenize the card and save it for future use.

Returns a ForageEbtCardNumberElement that is passed to the corresponding submit method to store a secure reference to the card number.

Parameters

TypeDescription
ebt_card_tokenize_number

required

stringThe constant string ebt_card_tokenize_number.

Example

const tokenizeEbtCardElement = forage.create('ebt_card_tokenize_number')

👍

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 ForageEbtCardNumberElement

forage.tokenizeEbtCardNumber(ForageEbtCardNumberElement)

This Forage method tokenizes an EBT Card number.

Parameters

TypeDescription
ForageEbtCardNumberElement

required

objectThe object returned by forage.create('ebt_card_tokenize_number').

Example

try {
  const tokenizedEbtCardResult = await forage.tokenizeEbtCardNumber(ebtCardNumberElement)
  const { ref: paymentMethodRef, type, balance, card } = tokenizedEbtCardResult
} catch (forageErr: ForageError) {
  const [error] = forageError.errors // handle ForageErrorObj[] list
  const { httpStatusCode, message, code } = error
}

Returns

forage.tokenizeEbtCardNumber(ForageEbtCardNumberElement) returns a Promise.

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

TypeDescription
refstringA string identifier that refers to an instance in Forage's database of a PaymentMethod, a tokenized representation of an EBT Card.
typestringA constant string; always ebt for Forage JS.
balanceobjectThe available SNAP and Cash balances on the EBT account associated with the EBT Card, the same as the object returned during a balance check.
cardobjectAn object with information about the card, as detailed in the card response fields.
card response fields
TypeDescription
last4stringThe last four digits of the EBT Card number.
statestringA two letter abbreviation for the US state.
typestringA constant string representing the type of the card. Always ebt for Forage JS.
tokenstringA tokenized form of the card number which allows Forage to securely lookup this EBT Card.
Example return value
{
  ref: 'ac47392bb1',
  type: 'ebt',
  balance: {
    snap: '100',
    non_snap: '100',
    updated: '2021-06-16T00:11:50.000000Z-07:00'
  },
  card: {
    last4: '3456',
    state: 'CA',
    type: 'ebt',
    token: 'tok_sandbox_12345678901234567890'
  }
}
Errors

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