# Payment request

## Generate a new payment request

> Create a new payment request with a specified amount, redirecting to the given url

```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":{"PaymentRequest":{"properties":{"id":{"type":"string"},"redirect_url":{"type":"string"},"reference_id":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"PaymentRequestInput":{"properties":{"amount":{"type":"string"},"redirect_url":{"type":"string"},"reference_id":{"type":"string"}},"type":"object"}}},"paths":{"/payments/request":{"post":{"description":"Create a new payment request with a specified amount, redirecting to the given url","operationId":"createPaymentRequest","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequest"}}}},"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":"Generate a new payment request","tags":["Payment request"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequestInput"}}},"description":"Payment request information","required":true}}}}}
```

## Retrieve a payment request by id

> Retrieves a payment request, together with its current status

```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":{"PaymentRequest":{"properties":{"id":{"type":"string"},"redirect_url":{"type":"string"},"reference_id":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/payments/request/{id}":{"get":{"description":"Retrieves a payment request, together with its current status","operationId":"getPaymentRequest","parameters":[{"schema":{"type":"string"},"description":"ID of the payment request","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequest"}}}},"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":"Retrieve a payment request by id","tags":["Payment request"]}}}}
```
