> For the complete documentation index, see [llms.txt](https://docs.ivpay.io/start/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ivpay.io/start/ivpay-api/api-reference/payments.md).

# Payments

The **Payment resource** in IVPAY allows you to create and read payment requests. You can initiate payments with specified fiat amounts and monitor their statuses. This resource simplifies payment management, ensuring efficient handling of transactions for businesses.

## `GET` Get payment

Get the payment details

### Endpoint

<mark style="color:green;">`GET`</mark> `/payment/{payment_id}`

### **Headers**

| Name         | Value               |
| ------------ | ------------------- |
| Content-Type | `application/json`  |
| X-API-KEY    | `your_api_key_here` |

### **Response**

{% tabs %}
{% tab title="200 OK" %}

```json
{
  "success": true,
  "data": {
    "payment_id": "6b577835afbefe60335b6e5cd04410a9",
    "foreign_id": "123456",
    "processed_at": 1726248785,
    "status": "PAID"
  }
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
  "success": false,
  "error": "Error message"
}
```

{% endtab %}

{% tab title="401 Unauthorized" %}

<pre class="language-json"><code class="lang-json">{
<strong>  "success": false,
</strong>  "error": "Wrong auth parameters"
}
</code></pre>

{% endtab %}
{% endtabs %}

## `POST` Create a new payment <a href="#create" id="create"></a>

Create a payment for the customer for a specified amount

### Endpoint

<mark style="color:green;">`POST`</mark> `/payment/create`

### **Headers**

| Name         | Value               |
| ------------ | ------------------- |
| Content-Type | `application/json`  |
| X-API-KEY    | `your_api_key_here` |

### **Body**

<table><thead><tr><th width="244">Name</th><th width="115">Type</th><th width="114">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>amount_fiat</code></td><td>string</td><td>Yes</td><td>Amount for payment</td></tr><tr><td><code>currency_fiat</code></td><td>string</td><td>Yes</td><td><p>Fiat currency ticker </p><p>(<a href="/pages/i7UO0bsc2Iua1z5ENRFV">List of supported currencies</a>)</p></td></tr><tr><td><code>foreign_id</code></td><td>string</td><td>No</td><td>Additional field (internal id, for example)</td></tr><tr><td><code>url_success</code></td><td>string</td><td>No</td><td>URL where to redirect the customer after a successful payment </td></tr><tr><td><code>url_failed</code></td><td>string</td><td>No</td><td>URL where to redirect the customer after a failed payment</td></tr></tbody></table>

### **Response**

{% tabs %}
{% tab title="200 OK" %}

```json
{
  "success": true,
  "data": {
    "payment_id": "6b577835afbefe60335b6e5cd04410a9",
    "payment_url": "https://pay.ivpay.io/payment/6b577835afbefe60335b6e5cd04410a9",
    "created_at": 1726248776,
    "foreign_id": "123456",
  }
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

<pre class="language-json"><code class="lang-json">{
<strong>  "success": false,
</strong>  "error": "Error message"
}
</code></pre>

{% endtab %}

{% tab title="401 Unauthorized" %}

```json
{
  "success": false,
  "error": "Wrong auth parameters"
}
```

{% endtab %}
{% endtabs %}

## Statuses

The possible payment statuses are explained [here](/start/get-started/concepts.md#the-payment-statuses).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ivpay.io/start/ivpay-api/api-reference/payments.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
