# Payments

## List payments

> Get a paginated list of payments with optional filtering

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":[]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"PaginatedResponse-Payment":{"properties":{"data":{"items":{"$ref":"#/components/schemas/Payment"},"type":"array"},"end_cursor":{"type":"string"},"has_next_page":{"type":"boolean"},"has_previous_page":{"type":"boolean"},"start_cursor":{"type":"string"}},"type":"object"},"Payment":{"properties":{"created_at":{"type":"string"},"customer_id":{"type":"string"},"due_date":{"type":"string"},"fees":{"items":{"$ref":"#/components/schemas/PaymentFee"},"type":"array"},"id":{"type":"string"},"payment_method":{"type":"string"},"status":{"type":"string"},"sub_total":{"type":"number"},"total":{"type":"number"}},"type":"object"},"PaymentFee":{"properties":{"amount":{"type":"number"},"covered_by_customer":{"type":"boolean"},"name":{"type":"string"},"type":{"description":"@enum FT_LATE_PAYMENT,FT_PRODUCT,FT_METHOD,FT_INTEREST","enum":["FT_LATE_PAYMENT","FT_PRODUCT","FT_METHOD","FT_INTEREST"],"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/payments":{"get":{"description":"Get a paginated list of payments with optional filtering","operationId":"listPayments","parameters":[{"schema":{"type":"integer","default":100},"description":"Number of items to return","in":"query","name":"limit"},{"schema":{"type":"string"},"description":"Specifies the cursor after which to start returning results. For the first page, this should be left empty. For subsequent pages, use the value of the end_cursor field from the previous response.","in":"query","name":"after"},{"schema":{"type":"string"},"description":"Specifies the cursor before which to return results. Use this to paginate backwards. For example, to load the previous page, provide the value of the start_cursor field from the last response.","in":"query","name":"before"},{"schema":{"type":"string","enum":["payment","refund","chargeback"]},"description":"Filter by payment type","in":"query","name":"type"},{"schema":{"type":"string","enum":["creating","processing","scheduled","succeeded","canceled","failed","pending"]},"description":"Filter by payment status","in":"query","name":"status"},{"schema":{"type":"string"},"description":"Filter by customer ID","in":"query","name":"customer_id"},{"schema":{"type":"string"},"description":"Filter by invoice ID","in":"query","name":"invoice_id"},{"schema":{"type":"string","enum":["card","standard_ach","same_day_ach","manual"]},"description":"Filter by payment method","in":"query","name":"payment_method"},{"schema":{"type":"string"},"description":"Filter by creation date start (RFC3339 format)","in":"query","name":"created_at_start"},{"schema":{"type":"string"},"description":"Filter by creation date end (RFC3339 format)","in":"query","name":"created_at_end"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse-Payment"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"List payments","tags":["Payments"]}}}}
```

## Create payment

> Create a single payment to charge an invoice.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":[]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreatePaymentRequest":{"description":"Request body for creating a payment","properties":{"amount":{"type":"string"},"customer_id":{"type":"string"},"idempotency_key":{"type":"string"},"invoice_id":{"type":"string"},"payment_date":{"type":"string"},"payment_method":{"description":"@enum card,standard_ach","enum":["card","standard_ach"],"type":"string"},"payment_method_id":{"type":"string"}},"type":"object"}}},"paths":{"/payments":{"post":{"description":"Create a single payment to charge an invoice.","operationId":"createPayment","responses":{"201":{"description":"Payment is being processed!","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create payment","tags":["Payments"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentRequest"}}},"description":"Payment request details","required":true}}}}}
```

## Get payment by ID

> Retrieve detailed information about a specific payment

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":[]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"Payment":{"properties":{"created_at":{"type":"string"},"customer_id":{"type":"string"},"due_date":{"type":"string"},"fees":{"items":{"$ref":"#/components/schemas/PaymentFee"},"type":"array"},"id":{"type":"string"},"payment_method":{"type":"string"},"status":{"type":"string"},"sub_total":{"type":"number"},"total":{"type":"number"}},"type":"object"},"PaymentFee":{"properties":{"amount":{"type":"number"},"covered_by_customer":{"type":"boolean"},"name":{"type":"string"},"type":{"description":"@enum FT_LATE_PAYMENT,FT_PRODUCT,FT_METHOD,FT_INTEREST","enum":["FT_LATE_PAYMENT","FT_PRODUCT","FT_METHOD","FT_INTEREST"],"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/payments/{id}":{"get":{"description":"Retrieve detailed information about a specific payment","operationId":"getPayment","parameters":[{"schema":{"type":"string"},"description":"Payment ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Get payment by ID","tags":["Payments"]}}}}
```
