Forage(ForageConfig)
Forage(ForageConfig) creates a Forage instance. A Forage instance interacts with the Forage server. You need a Forage instance before you can create an EBT Element and perform EBT checkout operations.
The constructor requires a ForageConfig object as its only parameter.
ForageConfig fields
| Field | Type | Description |
|---|---|---|
merchantIdrequired |
Example: Create a Forage instance
const forage = Forage({
merchantId: '123ab45c67',
sessionToken:
'sandbox_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhIjo0MiwiZXhwIjoxNjc2OTg2ODM1fQ.7KLvDpM9WHRD4pKCYr0rOy2kM0hVf3bwtZEAOZJrJ1w',
// NOTE: The following line is for testing purposes only and should not be used in production.
// Please replace this line with a real hashed customer ID value.
customerId: btoa(Math.random().toString()),
appearance: {
variables: {
borderRadius: '8px'
}
}
})