Render an input field where a user can enter their EBT card number. Submitting the input's value will store and tokenize the EBT card number within Forage's secure vault. This object will add an <iframe>
to the page's DOM.
Create a ForageCardCapture Frame using the constructor function.
Javascript
const forageCardCapture = new ForageCardCapture(
'ebt-card-capture',
'sandbox',
{
placeholder: 'Enter EBT Card',
successColor: '#4F8A10',
errorColor: '#D8000C'
}
)
Parameter Type Description nodeId string The id assigned to a html element. The object will insert the input element within this html element. environment string This is the card vault's environment, and it is one of two values: sandbox
or prod
. options (optional) object Optional configurations.
This method submits the EBT card number to your Forage vault.
JavaScript
forageCardCapture.submit(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhIjo0LCJleHAiOjE2Njg4MDcyNDF9.oQ2LMnhfTKEp-4dIuGuh3lec87_6rhKXfSJGMYMYNPA',
'1234567',
(statusCode, response) => handleForageCardInputSuccess(statusCode, response),
(errorResponse) => handleForageCardInputError(errorResponse)
)
Parameter Type Description sessionToken string The session token generated by your backend which authenticates your app against the Forage Payments API. fnsNumber string A 7 digit numeric string issued by the FNS to authorized SNAP merchants. successCallback function The logic to run if the card tokenization is successful. errorCallback function The logic to run if the card tokenization fails.
Parameter Type Description statusCode number Status code returned from Forage API. response object Response returned from Forage API.
Property Type Description ref string The Forage PaymentMethod reference. type string The type of card. This value will always be ebt
. balance object The balance of the EBT card. If the card has not been balance checked, this value is null. card object Useful card metadata, such as last_4
and created
.
Render an input field where a user can enter their EBT card PIN. Submitting the input's value will perform a balance check on the tokenized EBT card.
Create a ForageBalanceCapture Frame using the constructor function.
JavaScript
const forageBalanceCapture = new ForageBalanceCapture(
'balance-capture',
'sandbox',
{
placeholder: 'Enter PIN',
successColor: '#4F8A10',
errorColor: '#D8000C'
}
)
Parameter Type Description nodeId string The id assigned to a html element. The object will insert the input element within this html element. environment string This is the card vault's environment, and it is one of two values: sandbox
or prod
. options (optional) object Optional configurations.
Attempt to balance check a tokenized card and then call the appropriate callback function.
JavaScript
forageBalanceCapture.submit(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhIjo0LCJleHAiOjE2Njg4MDcyNDF9.oQ2LMnhfTKEp-4dIuGuh3lec87_6rhKXfSJGMYMYNPA',
'1234567',
'2304587ef3',
(statusCode, response) => handleForageBalanceCheckSuccess(statusCode, response),
(errorResponse) => handleForageBalanceCheckError(errorResponse)
)
Parameter Type Description sessionToken string The session token generated by your backend which authenticates your app against the Forage Payments API. fnsNumber string A 7 digit numeric string issued by the FNS to authorized SNAP merchants. paymentMethodRef string The 10 character ref
field of the PaymentMethod object you created when tokenizing the EBT card. successCallback function The logic to run if the balance check is successful. errorCallback function The logic to run if there are errors while executing a balance check. idempotencyKey (optional) string A key to be used to make balance requests idempotent (more info on idempotency ).
Parameter Type Description statusCode number Status code returned from Forage API. response object Response returned from Forage API.
Render an input field where a user can enter their EBT card PIN. Submitting the input's value will capture an EBT payment using a tokenized EBT card.
Create a ForagePaymentCapture frame using the constructor function.
JavaScript
const foragePaymentCapture = new ForagePaymentCapture(
'payment-capture',
'sandbox',
{
placeholder: 'Enter PIN',
successColor: '#4F8A10',
errorColor: '#D8000C'
}
)
Parameter Type Description nodeId string The id assigned to a html element. The object will insert the input element within this html element. environment string This is the card vault's environment, and it is one of two values: sandbox
or prod
. options (optional) object Optional configurations.
Attempt to accept a PIN and capture an EBT payment and then call the appropriate callback function.
JavaScript
foragePaymentCapture.submit(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhIjo0LCJleHAiOjE2Njg4MDcyNDF9.oQ2LMnhfTKEp-4dIuGuh3lec87_6rhKXfSJGMYMYNPA',
'1234567',
'e25212353f',
(statusCode, response) => handleSnapForageSuccessResponse(statusCode, response),
(errorResponse) => handleSnapForagePaymentError(errorResponse)
)
Parameter Type Description sessionToken string The session token generated by your backend which authenticates your app against the Forage Payments API. fnsNumber string A 7 digit numeric string issued by the FNS to authorized SNAP merchants. paymentRef string The 10 character ref
field of the Payment object, which you should have created before instantiating the ForagePaymentCapture object. successCallback function The logic to run if capturing the Payment is successful. errorCallback function The logic to run if there is an error while capturing the Payment.
Parameter Type Description statusCode number Status code returned from Forage API. response object The processed Forage Payment object. Important fields are amount
, funding_type
, and status
.
Property Type Description css object Custom css to be applied to the input field. successColor string Hex color code for the input field border when the input is valid. errorColor string Hex color code for the input field border when the input is not valid. placeholder string The placeholder text when there is no content inside the input field.
Parameter Type Description errorResponse object Error Response object returned from the Forage API.
errors array[ForageErrorObj ] An array of error objects returned from the Forage API.
httpStatusCode number Find the HTTP status codes that could be returned from the Forage API code string A short string indicating the error code reported from the Forage API. message string A developer-facing message providing more details about the error.
Property Type Description snap number Amount of SNAP balance on the EBT card. non_snap number Amount of EBT Cash balance on the EBT card. updated datetime Timestamp of the balance check request.
Property Type Description last_4 string The last 4 digits of the EBT card. created datetime The date and time that the EBT card was created. token string An internal token.
Property Type Description ref string The Forage Payment reference ID. merchant number The Merchant's FNS number. funding_type string Type of tender that was processed. Possible options are ebt_snap
, ebt_cash
, and credit_tpp
. amount number Amount that was processed. description string A short description of the Payment. metadata object Object that can be used to pass through metadata. payment_method string The Forage Payment Method reference ID for the Payment Method that was charged. delivery_address object Delivery address linked to the Payment. is_delivery boolean True if the Payment was for an order that will be delivered. created datetime Date and time that the Payment was created. updated datetime Date and time that the Payment was last updated. status string Current status of the Payment. Possible values are requires_confirmation
, processing
, canceled
, failed
, and succeeded
. last_processed_error object The most recently returned error while attempting to process this Payment. success_date datetime Date and time that the Payment was captured. refunds array[Refund ] List of refunds that have been applied to this Payment.
Property Type Description city string City of the address. country string Country code of the address. line1 string First line of the address. line2 string Second line of the address. state string State of the address. zipcode string Zip code of the address.