HomeGuidesReference
Log In
Reference

Collect an EBT Card PIN for server-side payment capture

📘

You can also capture an EBT payment client-side.

Create a 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

ParameterTypeDescription
collect_pin

required
stringThe constant string collect_pin.
elementOptionsobjectA set of optional configuration settings for the ForagePinElement. Refer to elementOptions.
elementOptions
FieldTypeDescription
styleobjectAn 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 the mount() 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

forage.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

ParameterTypeDescription
ForagePinElement

required
objectThe object returned by calling forage.create('collect_pin').
paymentRefstringA 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.