Payments API
Version 1.0.0
API for processing and managing payments.
Path Table
| Method | Path | Description |
|---|---|---|
| GET | /payments | List payments |
| POST | /payments | Create a payment |
| GET | /payments/{id} | Get payment by ID |
| PUT | /payments/{id} | Update a payment |
| DELETE | /payments/{id} | Cancel a payment |
Reference Table
| Name | Path | Description |
|---|---|---|
| Payment | #/components/schemas/Payment | |
| PaymentCreate | #/components/schemas/PaymentCreate | |
| PaymentUpdate | #/components/schemas/PaymentUpdate |
Path Details
GET /payments
-
Summary
List payments -
Description
Retrieve a list of payments.
Responses
- 200 A list of payments
application/json
{
id?: string
// Amount in cents.
amount?: integer
currency?: string
// Payment status.
status?: enum[pending, succeeded, failed, canceled]
createdAt?: string
}[]
POST /payments
-
Summary
Create a payment -
Description
Create a new payment.
RequestBody
- application/json
{
// Amount in cents.
amount: integer
currency: string
description?: string
}
Responses
- 201 Payment created
application/json
{
id?: string
// Amount in cents.
amount?: integer
currency?: string
// Payment status.
status?: enum[pending, succeeded, failed, canceled]
createdAt?: string
}
GET /payments/{id}
- Summary
Get payment by ID
Responses
- 200 Payment found
application/json
{
id?: string
// Amount in cents.
amount?: integer
currency?: string
// Payment status.
status?: enum[pending, succeeded, failed, canceled]
createdAt?: string
}
- 404 Payment not found
PUT /payments/{id}
-
Summary
Update a payment -
Description
Update metadata of a payment.
RequestBody
- application/json
{
description?: string
}
Responses
- 200 Payment updated
application/json
{
id?: string
// Amount in cents.
amount?: integer
currency?: string
// Payment status.
status?: enum[pending, succeeded, failed, canceled]
createdAt?: string
}
- 404 Payment not found
DELETE /payments/{id}
-
Summary
Cancel a payment -
Description
Cancel a payment that has not been completed.
Responses
-
204 Payment canceled
-
404 Payment not found
References
#/components/schemas/Payment
{
id?: string
// Amount in cents.
amount?: integer
currency?: string
// Payment status.
status?: enum[pending, succeeded, failed, canceled]
createdAt?: string
}
#/components/schemas/PaymentCreate
{
// Amount in cents.
amount: integer
currency: string
description?: string
}
#/components/schemas/PaymentUpdate
{
description?: string
}