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_id`` When Creating Payments
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 to ensure continuity of stored payment methods.
Payments Expire After 30 Minutes
Payment
objects expire after 30 minutes. If aPayment
is not captured or canceled within 30 minutes of when it's created, then it expires. To attempt the transaction again, create a newPayment
.