Payment Methods

The Forage PaymentMethod object represents a customer's payment instrument.

From a UI perspective, a PaymentMethod is created when a customer submits their card details to Forage. At the implementation level, the flow varies by integration type:

SDKs

Every SDK includes a method that tokenizes a customer’s EBT Card number and creates a Forage PaymentMethod:

SDKs also include a method to perform a balance inquiry on a tokenized EBT Card:

Custom integrations

Fully Hosted integrations

  • The Fully Hosted Checkout UI automatically creates a PaymentMethod under the hood.
  • To retrieve information about the PaymentMethod, save the ebt_payment_method value that Forage returns when the Session is created, so that you can pass it in the path params of a request to retrieve the PaymentMethod.
  • For more details on the complete Fully Hosted flow, check out the how it works diagram.

PaymentMethod object

{
    "ref": "2aa1583cdb",
    "type": "ebt",
    "reusable": false,
    "card": {
        "last_4": "9999",
        "created": "2024-02-06T12:59:43.147586-08:00",
        "token": "xxx,yyy",
        "state": null,
        "fingerprint": "470dda97b63f016a962de150cf53ad72a93aaea4c2a59de2541e0994f48e02ef" # New field
    },
    "balance": null
}

The balance property is null when a PaymentMethod is created. Once a balance inquiry has been executed on the PaymentMethod, subsequent GET requests for the PaymentMethod return the balance value.

Properties

PropertyTypeDescription
refstringA unique reference identifier for the PaymentMethod. The ref is constant for a customer_id if the card is reusable.
typestringThe type of the customer’s payment instrument. One of: ebt, credit,debit.

:warning: A PaymentMethod can only have a type value of credit or debit in a Fully Hosted integration.
reusablebooleanWhether the PaymentMethod can be reused. If false, then the PaymentMethod can only be used for a single transaction.
balanceobjectRefer to balance object. null until a balance inquiry has been performed.
cardobjectRefer to card object.
customer_idstringA unique merchant-generated ID for the end customer making the payment.

balance object

The balance object applies to PaymentMethods that represent an EBT Card.

If you’re building a Fully Hosted integration that processes credit or debit payment methods, then the balance value is null for the associated PaymentMethod objects.

PropertyTypeDescription
snapstringThe available SNAP balance on the customer’s EBT Card, represented as a numeric string.
non_snapstringThe available EBT Cash balance left on the EBT Card, represented as a numeric string.
updatedISO 8601 date-time stringThe date-time when the funds in the account last changed.

card object

card fields forebt payment methods

PropertyTypeDescription
last_4stringThe last four digits of the EBT Card number.
createdISO 8601 date-time stringA timestamp that indicates when the EBT PaymentMethod was created, represented as an ISO 8601 date-time string.
tokenstringA token that Forage can use to look up the EBT Card in secure storage.
statestringA two-letter abbreviation for the US state that issued the EBT Card (e.g. CA).
fingerprintstringA unique hash based on the card PAN. The fingerprint is constant for a card PAN, no matter the customer_id. Use the fingerprint to track card usage details for fraud prevention.

📘

The below card fields are only relevant to Fully Hosted integrations.

card fields for credit or debit payment methods

PropertyTypeDescription
brandstringThe brand of the card. One of: amex, discover, visa,mastercard.
exp_monthnumberThe month that the card expires, represented as a number between 1 (January) and 12 (December).
exp_yearnumberThe year that the card expires, represented as a two-digit number (e.g. 23).
last4stringThe last four digits of the card number.

card fields for credit or debit payment methods processed by Stripe

PropertyTypeDescription
brandstringThe brand of the card. One of: amex, discover, visa,mastercard.
exp_monthnumberThe month that the card expires, represented as a number between 1 (January) and 12 (December).
exp_yearnumberThe year that the card expires, represented as a two-digit number (e.g. 23).
last4stringThe last four digits of the card number.
psp_customer_idstringThe Stripe identifier for the customer.
payment_method_idstringA unique identifier for a Stripe PaymentMethod that represents a customer's credit/debit payment instrument.

Examples

Create a PaymentMethod

curl --request POST \
     --url https://api.sandbox.joinforage.app/api/payment_methods/ \
     --header 'API-VERSION: 2023-05-15' \
     --header 'Authorization: Bearer <session-token>' \
     --header 'Merchant-Account: <merchant-id>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "card": {
    "number": "<card-number>"
  },
  "type": "ebt",
  "reusable": true,
  "customer_id": "<customer-id>"
}
'

Refer to the POST /payment_methods/ docs for complete details.

Retrieve a PaymentMethod

curl --request POST \
     --url https://api.sandbox.joinforage.app/api/payment_methods/ref/ \
     --header 'API-VERSION: 2023-05-15' \
     --header 'Authorization: Bearer <session-token>' \
     --header 'Merchant-Account: <merchant-id>' \
     --header 'accept: application/json' \

Refer to the GET /payment_methods/{ref} docs for complete details.

Update a PaymentMethod

curl --request PATCH \
     --url https://api.sandbox.joinforage.app/api/payment_methods/payment_method_ref/ \
     --header 'Authorization: Bearer <authentication_token>' \
     --header 'Merchant-Account: <merchant-account>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "reusable": true,
  "customer_id": "cus_1234567890"
}
'

Refer to the PATCH /payment_methods/{payment_method_ref}/ docs for complete details

PaymentMethods and Platforms

If you're integrating Forage on behalf of a platform that supports multiple merchants, then note that you can re-use payment method refs across multiple merchants.