You can also capture an EBT payment client-side.
Create a ForagePinElement
ForagePinElement
forage.create('collect_pin', elementOptions)
This Forage method displays an input field that collects a customer’s EBT Card PIN before capturing a previously created Payment
server-side.
On success, this method returns a ForagePinElement
, one of the required parameters for the corresponding deferPaymentCapture
submit method.
Example request
const deferPaymentCaptureElement = forage.create('collect_pin', elementOptions)
Request parameters
Parameter | Type | Description |
---|---|---|
collect_pin required | string | The constant string collect_pin . |
elementOptions | object | A set of optional configuration settings for the ForagePinElement . Refer to elementOptions. |
elementOptions
elementOptions
Field | Type | Description |
---|---|---|
style | object | An object that sets certain CSS properties for the ForagePinElement . Current supported key-value pairs include:- borderColor : A string that indicates the border color- borderWidth : A string that specifies the border width |
After creating the
ForagePinElement
, call themount()
method to attach it to the DOM. Refer to the EBT Element lifecycle for more details.
Submit a ForagePinElement
to capture an EBT Card PIN for payment
ForagePinElement
to capture an EBT Card PIN for paymentforage.deferPaymentCapture(ForagePinElement, paymentRef)
The deferPaymentCapture
method collects an EBT Card PIN before capturing a previously created Payment
server-side.
It receives the ForagePinElement
returned by the call to forage.create('collect_pin')
and the Payment
ref that you plan to capture.
Example request
try {
await forage.deferPaymentCapture(
deferPaymentCaptureElement,
paymentRef
)
} catch (error) {
const { httpStatusCode, message, code } = error ?? {}
}
Request parameters
Parameter | Type | Description |
---|---|---|
ForagePinElement required | object | The object returned by calling forage.create('collect_pin') . |
paymentRef | string | A unique string identifier for a previously created Forage Payment instance that you plan to capture on the server.You need to send a server-side POST to the Forage /payments/ endpoint to create a Payment and retrieve its ref . |
For step by step instructions, check out the guide to capturing EBT payments server-side.