This endpoint is only relevant to Forage SDK integrations.
If you’re building with the Fully Hosted or Custom Forage Checkout UI, then use the
Order
andOrderPayment
endpoints.
To keep your app secure, requests to create a Payment should only be generated on the server-side.
A POST
request to /payments/
tells Forage’s servers how much to charge an existing PaymentMethod
.
On success, the API responds with a Forage Payment
object that represents the one-time charge. You need to pass the ref
response value to an SDK function to authorize and capture the payment, one of:
- Forage JS:
capturePayment()
- Android:
capturePayment()
- iOS:
capturePayment()
Pass
customer_id
in the request to Create aPayment
customer_id
helps Forage's servers more quickly identify and associate the correct customer with thePayment
. Whilecustomer_id
is not technically a required parameter, if you omit it then the request to create thePayment
could take longer to process. It is strongly recommended to passcustomer_id
.Each customer should only have one unique
customer_id
. For example, if you create both aPayment
and aPaymentMethod
for the same customer, then thecustomer_id
should be the same in both requests.
Payment
objects expire after 30 minutes.If a
Payment
is not captured or canceled within 30 minutes of when it's created, then it expires. To attempt the transaction again, create a newPayment
.