Create a ForageEbtCardNumberElement
ForageEbtCardNumberElement
forage.create('ebt_card_tokenize_number')
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
Type | Description | |
---|---|---|
ebt_card_tokenize_number required | string | The constant string ebt_card_tokenize_number . |
Example
const tokenizeEbtCardElement = forage.create('ebt_card_tokenize_number')
After creating the
EBT Element
, call themount()
method to attach it to the DOM. Refer to theEBT Element
lifecycle for more details.
Submit a ForageEbtCardNumberElement
ForageEbtCardNumberElement
forage.tokenizeEbtCardNumber(ForageEbtCardNumberElement)
forage.tokenizeEbtCardNumber(ForageEbtCardNumberElement)
This Forage method tokenizes an EBT Card number.
Parameters
Type | Description | |
---|---|---|
ForageEbtCardNumberElement required | object | The 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:
Type | Description | |
---|---|---|
ref | string | A string identifier that refers to an instance in Forage's database of a PaymentMethod, a tokenized representation of an EBT Card. |
type | string | A constant string; always ebt for Forage JS. |
balance | object | The available SNAP and Cash balances on the EBT account associated with the EBT Card, the same as the object returned during a balance check. |
card | object | An object with information about the card, as detailed in the card response fields. |
card
response fields
card
response fieldsType | Description | |
---|---|---|
last4 | string | The last four digits of the EBT Card number. |
state | string | A two letter abbreviation for the US state. |
type | string | A constant string representing the type of the card. Always ebt for Forage JS. |
token | string | A 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.