Payment Creation Must Be Server-Side
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()
Use
customer_idWhen Creating PaymentsPass
customer_idin the request to Create aPayment.customer_idhelps Forage's servers more quickly identify and associate the correct customer with thePayment. Whilecustomer_idis not technically a required parameter, if you omit it then the request to create thePaymentcould 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 aPaymentand aPaymentMethodfor the same customer, then thecustomer_idshould be the same in both requests to ensure continuity of stored payment methods.
Payments Expire After 30 Minutes
Paymentobjects expire after 30 minutes. If aPaymentis not captured or canceled within 30 minutes of when it's created, then it expires. To attempt the transaction again, create a newPayment.
