---
updatedAt: 2026-05-15T15:22:44.000Z
agentTools:
  projectIndex: https://docs.joinforage.app/llms.txt
---

# Collect an EBT Card PIN for server-side payment capture

> 📘 Capture EBT Payment Client-Side
>
> You can also [capture an EBT payment client-side](https://docs.joinforage.app/reference/capture-ebt-payment).

## 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.](https://linear.app/joinforage/issue/TW-369/payments-api-docs-for-back-end-payment-capture#comment-4de1b239)

On success, this method returns a `ForagePinElement`, one of the required parameters for the corresponding `deferPaymentCapture` [submit method](#submit-a-foragepinelement-to-capture-an-ebt-card-pin-for-payment).

### Example request

```javascript
const deferPaymentCaptureElement = forage.create('collect_pin', elementOptions)
```

#### Request parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td align="left">
        <code>collect_pin</code><br />
        <span style={{color:"red"}}>required</span>
      </td>
      <td align="left">string</td>
      <td align="left">The constant string <code>collect_pin</code>.</td>
    </tr>
    <tr>
      <td align="left"><code>elementOptions</code></td>
      <td align="left">object</td>
      <td align="left">A set of optional configuration settings for the <code>ForagePinElement</code>. Refer to <a href="#elementoptions">elementOptions</a>.</td>
    </tr>
  </tbody>
</table>

##### `elementOptions`

<table>
  <thead>
    <tr>
      <th align="left">Field</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td align="left"><code>style</code></td>
      <td align="left">object</td>
      <td align="left">
        An object that sets certain CSS properties for the <code>ForagePinElement</code>. Current supported key-value pairs include:<br />
        <ul>
          <li><code>borderColor</code>: A string that indicates the border color</li>
          <li><code>borderWidth</code>: A string that specifies the border width</li>
        </ul>
      </td>
    </tr>
  </tbody>
</table>

> 📘 Mount The `ForagePinElement`
>
> After creating the `ForagePinElement`, call the [`mount()`](https://docs.joinforage.app/reference/mount) method to attach it to the DOM. Refer to the [EBT Element lifecycle](https://docs.joinforage.app/reference/ebt-elements#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](https://docs.joinforage.app/reference/capture-a-payment).

It receives the `ForagePinElement` returned by the call to `forage.create('collect_pin')` and the `Payment` ref that you plan to capture.

### Example request

```javascript
try {
  await forage.deferPaymentCapture(
    deferPaymentCaptureElement,
    paymentRef
  )
} catch (error) {
  const { httpStatusCode, message, code } = error ?? {}
}
```

#### Request parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td align="left">
        <code>ForagePinElement</code><br />
        <span style={{color:"red"}}>required</span>
      </td>
      <td align="left">object</td>
      <td align="left">The object returned by calling <code>forage.create('collect_pin')</code>.</td>
    </tr>
    <tr>
      <td align="left"><code>paymentRef</code></td>
      <td align="left">string</td>
      <td align="left">
        A unique string identifier for a previously created Forage <a href="ref:payments">Payment</a> instance that you plan to capture on the server.<br />
        You need to send a server-side <code>POST</code> to the Forage <code>/payments/</code> endpoint to create a <code>Payment</code> and retrieve its <code>ref</code>.
      </td>
    </tr>
  </tbody>
</table>

For step by step instructions, check out the [guide to capturing EBT payments server-side](https://docs.joinforage.app/docs/capture-ebt-payments-server-side).

# Sibling pages

* [Tokenize an EBT Card](https://docs.joinforage.app/reference/store-an-ebt-card.md)
* [Check the balance of an EBT card](https://docs.joinforage.app/reference/check-the-balance-of-an-ebt-card.md)
* [Capture an EBT payment](https://docs.joinforage.app/reference/capture-ebt-payment.md)
* [Tokenize a Payment Sheet](https://docs.joinforage.app/reference/tokenize-a-payment-sheet.md)