v1

latestOpenAPI 3.0.02026-07-244352379.2 KB
Payments

Update an OrderPayment

⚠️ Update OrderPayment Server-Side Only

To keep your app secure, requests to update an OrderPayment should only be generated on the server-side.

A PATCH request to /orders/{order_ref}/payments/{payment_ref}/ updates an existing Forage OrderPayment.

On success, the API responds with the updated OrderPayment object.

The status property of the OrderPayment determines what data can be updated. If the status is processing, canceled, or succeeded, then only the following Payment fields can be modified:

  • metadata
  • external_order_id

During these statuses, Forage ignores attempts to update other OrderPayment fields.

patch/api/orders/{order_ref}/payments/{payment_ref}/

Headers

Authorizationstring required

An OAuth 2.0 authentication token that validates the request. Send a POST to the /o/token/ endpoint to generate an authentication token. Pass the token in this header after the word Bearer and a whitespace, for example Bearer <api_key>.

Merchant-Accountstring required

A unique merchant ID that Forage provides during onboarding, as in 123ab45c67. The Merchant ID can be found in the Forage sandbox or production dashboard.

Idempotency-Keystring required

An alphanumeric key that clients can use to identify repeated requests that are dropped in transit. Generate a distinct key for every unique request and only re-use keys for retries.

Request body

amountnumber

A positive decimal number that represents how much to charge the PaymentMethod in USD. Precision is supported to the penny. The minimum amount that can be charged is 0.01. To differentiate between a SNAP and an EBT Cash charge on the same EBT Card, use the funding_type field. If you need to charge both funding types, then create a Payment for each charge.

funding_type'ebt_snap' | 'ebt_cash' | 'credit_tpp' | 'credit_payfac'

The payment instrument type. Use this field to differentiate between a SNAP (ebt_snap) and an EBT Cash (ebt_cash) charge on the same EBT Card. If you need to charge both funding types, then create a Payment for each charge. Use credit_payfac for all charges to HSA/FSA cards. credit_tpp is the funding type assigned to non-EBT payment objects created via a Fully Hosted Checkout integration.

payment_methodstring

The unique reference hash for the existing Forage PaymentMethod that is to be charged in this transaction.

⚠️ Exception: POS integrations do not need to provide a payment_method when creating a payment.

is_deliveryboolean

⚠️ Exception: If the purchase is made in-store via a POS Terminal, then a is_delivery is not required when creating a Payment.

Whether the order is for delivery or pickup. This information is required per FNS regulations. Defaults to false if not provided.

descriptionstring

A description of the payment.

metadataMetadataObject

A required object containing merchant-defined key-value pairs to provide additional context for the payment.

Merchants should use this field to store reference information relevant to the transaction (for example, order details, system identifiers, or tracking data). This helps link the payment to records within their system.

Pass an empty object ({}) if no additional information is available.

⚠️ Personally Identifiable Information

Do not include personally identifiable information (PII) such as names, emails, or payment details.

platform_feenumber

An optional field, for use by a platform supporting multiple merchants, that indicates the percentage cut of each payment that the platform charges as a fee.

platform_fixed_settlementnumber

The fixed amount in USD that a platform takes from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

merchant_fixed_settlementnumber

The fixed amount in USD that should be restored to the merchant from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

tpp_lookup_idstring

An identifier for the credit/debit TPP.

For Stripe integrations, the client secret for a Stripe PaymentIntent.

customer_idstring

⚠️ If you’re integrating Forage with a POS Terminal, then do not use this param. It is only supported for online transactions.

A unique identifier for the end customer making the payment.

Forage automatically adds the customer_id to the Session's corresponding Order and OrderPayments.

This field helps Forage's servers more quickly identify the customer associated with the request. While customer_id is not technically required, if you omit it then requests could take longer to process. It is strongly recommended to pass customer_id.

If you're providing your internal customer ID, then we recommend that you hash the value before sending it on the payload.

Each customer should only have one unique customer_id. For example, if you create both a PaymentMethod and a Forage Session (Fully Hosted or Custom) or Payment (SDK) for the same customer, then the customer_id should be the same in both requests to ensure continuity of stored payment methods.

external_order_idstring

A unique identifier for the order as created by the merchant or platform (not Forage).

When a merchant or platform passes this order ID to Forage, it persists in each Forage transaction related to the Order. This field enables merchants to map order IDs in their system to corresponding Forage Order IDs.

You must build with Forage Version 2023-05-15 or later to use external_order_id. Either pass 2023-05-15 as the API-Version header on a per request basis, or set the version for all requests in the Forage dashboard.

merchant_destination_accountstring

A unique reference hash for the bank account that is to receive funds settlement for this payment. Use this field if you're settling funds across multiple merchant bank accounts. Reach out to your Forage account manager for details on generating a hash.

Defaults to the hash for the default merchant bank account if not provided.

external_location_idstring

A unique identifier, provided by the merchant or platform (not Forage), that indicates the physical fulfillment location for the order. For example, this field could specify which location of a grocery store chain fulfilled an order.

Example request

{
  "tpp_lookup_id": "pi_1DpdZq2eZvKYlo2CAYyzTr8j_secret_lxr4crBJP4txbrg7sqit0XQQO",
  "external_location_id": "6e3b2ff7-51c8-4c64-befa-2eac90f7c3e9"
}

Response

OK - Success

funding_type'benefit' | 'credit_tpp' | 'ebt_cash' | 'ebt_snap' required

A string that represents the type of tender. One of:

  • benefit
  • credit_tpp
  • ebt_cash
  • ebt_snap
amountnumber required

A positive decimal number that represents how much to charge the PaymentMethod in USD. Precision is supported to the penny.

This value must match the ebt_cash_total or snap_total value that was passed in the request that created the Custom Capture Session, depending on the funding_type.

If you need to charge both funding types, then create an OrderPayment for each charge, using the same order_ref returned when the order's parent Payment Capture Session was created.

The minimum amount that can be charged is 0.01.

descriptionstring required

A string that describes the OrderPayment.

metadataobject required

A required object containing merchant-defined key-value pairs to provide additional context for the payment.

Merchants should use this field to store reference information relevant to the transaction (for example, order details, system identifiers, or tracking data). This helps link the payment to records within their system.

Pass an empty object ({}) if no additional information is available.

⚠️ Personally Identifiable Information

Do not include personally identifiable information (PII) such as names, emails, or payment details.

payment_methodstring required

The unique reference hash for the existing Forage PaymentMethod that is to be charged in this transaction.

customer_idstring

⚠️ If you’re integrating Forage with a POS Terminal, then do not use this param. It is only supported for online transactions.

A unique identifier for the end customer making the payment.

Forage automatically adds the customer_id to the Session's corresponding Order and OrderPayments.

This field helps Forage's servers more quickly identify the customer associated with the request. While customer_id is not technically required, if you omit it then requests could take longer to process. It is strongly recommended to pass customer_id.

If you're providing your internal customer ID, then we recommend that you hash the value before sending it on the payload.

Each customer should only have one unique customer_id. For example, if you create both a PaymentMethod and a Forage Session (Fully Hosted or Custom) or Payment (SDK) for the same customer, then the customer_id should be the same in both requests to ensure continuity of stored payment methods.

external_order_idstring

A unique identifier for the order as created by the merchant or platform (not Forage).

When a merchant or platform passes this order ID to Forage, it persists in each Forage transaction related to the Order. This field enables merchants to map order IDs in their system to corresponding Forage Order IDs.

You must build with Forage Version 2023-05-15 or later to use external_order_id. Either pass 2023-05-15 as the API-Version header on a per request basis, or set the version for all requests in the Forage dashboard.

merchant_fixed_settlementnumber

The fixed amount in USD that should be restored to the merchant from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

platform_fixed_settlementnumber

The fixed amount in USD that should be restored to the platform from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

external_location_idstring

A unique identifier, provided by the merchant or platform (not Forage), that indicates the physical fulfillment location for the order. For example, this field could specify which location of a grocery store chain fulfilled an order.

refstring

A unique reference hash for the Forage OrderPayment object.

Note: receipt.ref_number equals ref.

status'canceled' | 'failed' | 'processing' | 'requires_confirmation' | 'succeeded'

The status of the OrderPayment. One of:

  • canceled: The OrderPayment object can't be used.
  • failed: If the error is temporary, then this OrderPayment can be resubmitted for capture without modification. Check the receipt.message field for a description of the error.
  • processing: The outcome of the OrderPayment is pending.
  • requires_confirmation: The OrderPayment hasn't been submitted for processing.
  • succeeded: The OrderPayment has been successfully processed and will be included in settlement. It can't be changed.
last_processing_errorobject

The code and message values corresponding to the most recent Payments API error.

createdstring date-time

A UTC timestamp, represented as an ISO 8601 date-time string, of when the OrderPayment was created.

updatedstring date-time

A UTC timestamp, represented as an ISO 8601 date-time string, of when the OrderPayment was last modified.

success_datestring date-time

A UTC timestamp, represented as an ISO 8601 date-time string, of when the status of the OrderPayment is succeeded. This value is always null when the OrderPayment is first created.

refundsstring[]

An array of the unique reference hashes for any OrderRefunds associated with this OrderPayment.

tpp_lookup_idstring

This value is always null for OrderPayments resulting from Custom Sessions. It’s most relevant to Fully Hosted Sessions, which process credit/debit payments.

A value that merchants can use to associate this payment with a credit/debit payment processed by a third party processor.

For Stripe integrations, this is the client secret for a PaymentIntent.

orderstring

A unique reference hash for the parent Order, as passed in the request to create the OrderPayment.

Example response

{
  "merchant_fixed_settlement": 5.11,
  "platform_fixed_settlement": 5.11,
  "external_location_id": "6e3b2ff7-51c8-4c64-befa-2eac90f7c3e9",
  "ref": "cc3175bfea",
  "status": "requires_confirmation",
  "created": "2021-06-16T00:11:50.000000Z",
  "updated": "2021-06-16T00:11:50.000000Z",
  "success_date": "2021-06-16T00:11:50.000000Z",
  "refunds": [
    "ac47392bb1"
  ],
  "tpp_lookup_id": "pi_1DpdZq2eZvKYlo2CAYyzTr8j_secret_lxr4crBJP4txbrg7sqit0XQQO",
  "order": "340129aff3"
}