# Redirect payment flow

## Prerequisites

* Your business account with Inqud is set up, complete with API tokens configured.
* The Crypto Widget has been established and configured within the Inqud platform.
* The Crypto Widget is active.
* **Checkout** web-hook is configured.

## Workflow

<figure><img src="/files/uAgvqizaEpR6vpHodmBX" alt=""><figcaption></figcaption></figure>

#### Checkout status transitions

<figure><img src="/files/eeGsUow6Hj03h2qJyS2i" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Visit the [Checkouts page](/crypto-widget/explore/checkouts.md#checkout-statuses) to learn more about the various checkout statuses.
{% endhint %}

## Integration

#### 1. Create Checkout through Inqud API

{% embed url="<https://apireference.inqud.com/#tag/crypto-acquiring-checkouts/operation/user_crypto-acquiring_create-checkout>" fullWidth="false" %}

{% tabs %}
{% tab title="Fixed Price" %}
Request Example:

```http
POST https://api.inqud.com/v1/user/crypto-acquiring/{projectId}/checkouts
```

{% hint style="info" %}
`projectId` is the ID of the widget
{% endhint %}

| Header             | Value            |
| ------------------ | ---------------- |
| X-Token-API-Id     | {tokenApiId}     |
| X-Token-API-Secret | {tokenApiSecret} |

Request Body Example:

```json
{
    "clientOrderId": "1234567890",
    "expiresAt": "2024-12-01T12:00:00Z",
    "fixedAmount": {
        "amount": 100,
        "currency": "USD"
    },
    "returnUrl": "https://example.com/return",
    "name": "My shopping cart checkout",
    "type": "FIXED_PRICE"
}
```

Response Body Example:

```json
{
  "id": "CCO-8c4df2e6-8c0d-4fa6-bba8-4943038dd5c5",
  "projectId": "CAP-df02b127-6717-4a73-a231-5a57155308a5",
  "projectName": "test",
  "clientOrderId": "1234567890",
  "status": "NEW",
  "name": "My shopping cart checkout",
  "type": "FIXED_PRICE",
  "fixedAmount": {
    "currency": "USD",
    "amount": 100
  },
  "returnUrl": "https://example.com/return",
  "acquiringUrl": "https://paycrypto.inqud.com/checkout/CCO-8c4df2e6-8c0d-4fa6-bba8-4943038dd5c5",
  "createdAt": "2023-12-22T09:17:26.081523507Z",
  "expiresAt": "2024-12-01T12:00:00Z"
}
```

{% hint style="info" %}
The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full [API specification](https://apireference.inqud.com/#tag/crypto-acquiring-checkouts/operation/user_crypto-acquiring_create-checkout).
{% endhint %}
{% endtab %}

{% tab title="Top Up" %}
Request Example:

```http
POST https://api.inqud.com/v1/user/crypto-acquiring/{projectId}/checkouts
```

{% hint style="info" %}
`projectId` is the ID of the widget
{% endhint %}

| Header             | Value            |
| ------------------ | ---------------- |
| X-Token-API-Id     | {tokenApiId}     |
| X-Token-API-Secret | {tokenApiSecret} |

Request Body Example:

```json
{
  "clientOrderId": "12345676890",
  "expiresAt": "2024-12-01T12:00:00Z",
  "name": "My website balance top up",
  "returnUrl": "https://example.com/return",
  "type": "NO_PRICE"
}
```

Response Example:

```json
{
  "id": "CCO-81162548-7d14-4b07-b7f5-f2c6eb3e901b",
  "projectId": "CAP-df02b127-6717-4a73-a231-5a57155308a5",
  "projectName": "test",
  "clientOrderId": "12345676890",
  "status": "NEW",
  "name": "My website balance top up",
  "type": "NO_PRICE",
  "returnUrl": "https://example.com/return",
  "acquiringUrl": "https://paycrypto.inqud.com/checkout/CCO-81162548-7d14-4b07-b7f5-f2c6eb3e901b",
  "createdAt": "2023-12-22T09:59:46.882256224Z",
  "expiresAt": "2024-12-01T12:00:00Z"
}
```

{% hint style="info" %}
The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full [API specification](https://apireference.inqud.com/#tag/crypto-acquiring-checkouts/operation/user_crypto-acquiring_create-checkout).
{% endhint %}
{% endtab %}

{% tab title="Predefined Amounts" %}
{% hint style="warning" %}
[Widget](/crypto-widget/explore/widget.md#predefined-amounts) come from the widget settings and cannot be changed via REST API requests.
{% endhint %}

Request Example:

```http
POST https://api.inqud.com/v1/user/crypto-acquiring/{projectId}/checkouts
```

{% hint style="info" %}
`projectId` is the ID of the widget
{% endhint %}

| Header             | Value            |
| ------------------ | ---------------- |
| X-Token-API-Id     | {tokenApiId}     |
| X-Token-API-Secret | {tokenApiSecret} |

Request Body Example:

```json
{
  "clientOrderId": "12345676890",
  "expiresAt": "2024-12-01T12:00:00Z",
  "name": "My website donation",
  "returnUrl": "https://example.com/return",
  "type": "SUGGESTED_FIXED_PRICE"
}
```

Response Example:

```json
{
  "id": "CCO-81162548-7d14-4b07-b7f5-f2c6eb3e901b",
  "projectId": "CAP-df02b127-6717-4a73-a231-5a57155308a5",
  "projectName": "test",
  "merchantDomain": "paycrypto.inqud.com",
  "clientOrderId": "12345676890",
  "status": "NEW",
  "name": "My website balance top up",
  "type": "SUGGESTED_FIXED_PRICE",
  "returnUrl": "https://example.com/return",
  "acquiringUrl": "https://paycrypto.inqud.com/checkout/CCO-81162548-7d14-4b07-b7f5-f2c6eb3e901b",
  "createdAt": "2023-12-22T09:59:46.882256224Z",
  "expiresAt": "2024-12-01T12:00:00Z"
}
```

{% hint style="info" %}
The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full [API specification](https://apireference.inqud.com/#tag/crypto-acquiring-checkouts/operation/user_crypto-acquiring_create-checkout).
{% endhint %}
{% endtab %}
{% endtabs %}

#### 2. Redirect end user to acquiring URL

Extract `acquiringUrl` from Checkout response and redirect your end user to it.

#### 3. Receive a web-hook notification related to the checkout

{% content-ref url="/pages/3Ux8aUbTVNkc7QcgK7tz" %}
[Checkout Web Hook](/crypto-widget/integration/web-hooks/checkout-web-hook.md)
{% endcontent-ref %}


---

# 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.inqud.com/crypto-widget/integration/redirect-payment-flow.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.
