# 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":["payments:write"]}],"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":["payments:read"]}],"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"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alternativepayments.io/api-reference/payment-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
