HomeGuidesReference
Log InDashboard
Reference
Dashboard

Create an OrderPayment

Outdated Endpoint

This endpoint is not relevant to Forage versions 2024-03-05 and later.

With 2024-03-05, Forage creates OrderPayments under the hood with every request to create a Custom Payment Capture Session. We strongly recommend upgrading to the latest Forage version if you haven't already.

OrderPayment Requests Must Be Server-Side

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

A POST request to /orders/{order_ref}/payments/ tells Forage’s servers how much to charge an existing PaymentMethod to create a payment associated with an existing Order.

On success, the API responds with a Forage OrderPayment object that represents the one-time charge. The PaymentMethod is not charged until the Order is captured, after a customer submits their PIN via the Forage Checkout UI to authorize the charge.

Use `customer_id`` For OrderPayments

Pass customer_id in the request to Create an OrderPayment

customer_id helps Forage's servers more quickly identify and associate the correct customer with the OrderPayment. While customer_id is not technically a required parameter, if you omit it then the request to create the OrderPayment could take longer to process. It is strongly recommended to pass customer_id.

Each customer should only have one unique customer_id. For example, if you create both an OrderPayment and a PaymentMethod for the same customer, then the customer_id should be the same in both requests to ensure continuity of stored payment methods.

Avoid Duplicate OrderPayment Requests

Only create one OrderPayment per PaymentMethod associated with an Order.

The API returns a 400 if it identifies a duplicate charge. If you need to increase the amount charged to a PaymentMethod already associated with an Order, then update the corresponding OrderPayment instead of creating a new one.

Language
Credentials
OAuth2
URL