# Using your own UI with Inqud processing

## 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.
* **Request** web-hook is configured.

## Workflow

<figure><img src="https://2493659114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVvChLJdAqFu9uz7E-7%2Fuploads%2FRs7FILQYURF6vPzVFEpC%2Fimage.png?alt=media&#x26;token=aa8614fe-92a4-462f-b9dc-ecf5ce94d254" alt=""><figcaption></figcaption></figure>

#### Request status transitions

<figure><img src="https://2493659114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVvChLJdAqFu9uz7E-7%2Fuploads%2FdXN5idF2mZ4zlrZ5wXHI%2Fimage.png?alt=media&#x26;token=47005037-8ad4-4e91-b104-dcf8c130de12" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Visit the [Requests page](https://docs.inqud.com/explore/requests#request-statuses) to learn more about the various request statuses.
{% endhint %}

## Integration

#### 1.  Get Deposit Options from Inqud API

[Get Deposit Options API Reference](https://apireference.inqud.com/#tag/crypto-acquiring-requests/operation/user_crypto-acquiring_get-deposit-options)

Request Example:

`GET https://api.inqud.com/v1/user/crypto-acquiring/{widgetId}/deposit-options`

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

<details>

<summary>Response Example</summary>

```json
{
  "cryptoCurrencies": [
    "ETHEREUM_USDT",
    "TRON_USDT",
    "SOLANA_USDT",
    "SOLANA_USDC"
  ],
  "limits": {
    "ETHEREUM_USDT": {
      "minLimit": 1,
      "maxLimit": 999999,
      "convertRate": null,
      "convertPair": null
    },
    "TRON_USDT": {
      "minLimit": 2,
      "maxLimit": 999999,
      "convertRate": null,
      "convertPair": null
    },
    "SOLANA_USDT": {
      "minLimit": 0.001,
      "maxLimit": 999999,
      "convertRate": null,
      "convertPair": null
    },
    "SOLANA_USDC": {
      "minLimit": 0.001,
      "maxLimit": 99999,
      "convertRate": null,
      "convertPair": null
    }
  },
  "minLimits": {
    "ETHEREUM_USDT": 1,
    "TRON_USDT": 2,
    "SOLANA_USDT": 0.001,
    "SOLANA_USDC": 0.001
  },
  "maxLimits": {
    "ETHEREUM_USDT": 999999,
    "TRON_USDT": 999999,
    "SOLANA_USDT": 999999,
    "SOLANA_USDC": 99999
  },
  "amountInOptions": {
    "ETHEREUM_USDT": {
      "USD": {
        "minLimit": 1.0067,
        "maxLimit": 1006698.9933,
        "convertRate": 1.0067,
        "convertPair": "USDTUSD"
      },
      "USDT": {
        "minLimit": 1,
        "maxLimit": 999999,
        "convertRate": null,
        "convertPair": null
      }
    },
    "TRON_USDT": {
      "USD": {
        "minLimit": 2.0134,
        "maxLimit": 1006698.9933,
        "convertRate": 1.0067,
        "convertPair": "USDTUSD"
      },
      "USDT": {
        "minLimit": 2,
        "maxLimit": 999999,
        "convertRate": null,
        "convertPair": null
      }
    },
    "SOLANA_USDT": {
      "USD": {
        "minLimit": 0.0010067,
        "maxLimit": 1006698.9933,
        "convertRate": 1.0067,
        "convertPair": "USDTUSD"
      },
      "USDT": {
        "minLimit": 0.001,
        "maxLimit": 999999,
        "convertRate": null,
        "convertPair": null
      }
    },
    "SOLANA_USDC": {
      "USDC": {
        "minLimit": 0.001,
        "maxLimit": 99999,
        "convertRate": null,
        "convertPair": null
      }
    }
  },
  "merchantFixedPlatformFees": {
    "ETHEREUM_USDT": 0,
    "TRON_USDT": 0,
    "SOLANA_USDT": 0,
    "SOLANA_USDC": 0
  },
  "merchantPercentPlatformFees": {
    "ETHEREUM_USDT": 0,
    "TRON_USDT": 0,
    "SOLANA_USDT": 0,
    "SOLANA_USDC": 0
  },
  "payerFixedPlatformFees": {},
  "payerPercentPlatformFees": {},
  "suggestedAmounts": null
}

```

</details>

#### 2. Create Fixed Price Request through Inqud API

[Requests API Reference](https://apireference.inqud.com/#tag/crypto-acquiring-requests/operation/user_crypto-acquiring_create-request)

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

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

{% 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
{
    "amount": 100,
    "amountIn": "USD",
    "clientOrderId": "1234567890",
    "cryptoCurrency": "ETHEREUM_USDT"
}
```

Response Example:

```json
{
  "id": "CAPD-8f57bdbe-b485-41e2-a850-ef4feb45759c",
  "orderId": "ORD-5e5e6551-3cae-4124-a299-6fef30105fb9",
  "clientOrderId": "1234567890",
  "currency": "USDT",
  "blockchain": "ETHEREUM",
  "status": "WAITING_PAYMENT",
  "cryptoAcquiringProjectId": "CAP-df02b127-6717-4a73-a231-5a57155308a5",
  "cryptoAcquiringProjectName": "test",
  "checkoutId": null,
  "address": "0xd954c250e68d2e4585a83d01c2f620ca0f9e94e5",
  "paymentWindowEndsAt": "2023-12-22T09:49:13.124979025Z",
  "expiresAt": "2023-12-22T09:49:13.125002012Z",
  "createdAt": "2023-12-22T09:39:13.125003488Z",
  "lastUpdatedAt": null,
  "paymentStatus": null,
  "paymentId": null,
  "payment": null,
  "txHash": null,
  "requestAmount": 100,
  "requestAmountIn": "USD",
  "requestAmountConverted": 99.46291,
  "convertPair": "USDTUSD",
  "convertRate": 1.0054,
  "payAmount": 99.46291,
  "payerPlatformFee": 0,
  "payerFixedPlatformFee": null,
  "payerPercentPlatformFee": null,
  "merchantPlatformFee": 5.07315,
  "merchantFixedPlatformFee": 0.1,
  "merchantPercentPlatformFee": 5,
  "processingAmount": 94.38976,
  "paidAmount": null,
  "overpaid": false
}
```

The following fields in the response are the most important:

| Column              | Desciption                                                                                                                                                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| currency            | Currency of payment                                                                                                                                                                                                            |
| blockchain          | Blockchain of payment                                                                                                                                                                                                          |
| address             | The address end user should pay to                                                                                                                                                                                             |
| paymentWindowEndsAt | This timestamp is provided to the user to indicate the payment window's closure. However, Inqud makes a slight extension beyond this time to accommodate potential delays in the blockchain network.                           |
| payAmount           | This represents the amount the user is expected to pay. The user has the option to pay this exact amount or more. However, if the payment is less than the expected amount, the request will be flagged as CONFLICT/UNDERPAID. |

{% 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-requests/operation/user_crypto-acquiring_create-request).
{% endhint %}
{% endtab %}

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

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

{% 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": "12345672890",
  "cryptoCurrency": "ETHEREUM_USDT"
}
```

Response Example:

```json
{
  "id": "CAPD-f275c7af-a369-4351-a8e2-22b74c853933",
  "orderId": "ORD-812db356-a8d4-4890-8e15-df086500db8f",
  "clientOrderId": "12345672890",
  "currency": "USDT",
  "blockchain": "ETHEREUM",
  "status": "WAITING_PAYMENT",
  "cryptoAcquiringProjectId": "CAP-df02b127-6717-4a73-a231-5a57155308a5",
  "cryptoAcquiringProjectName": "test",
  "checkoutId": null,
  "address": "0xb9253575b8acaf51fe8ab92b05f5dd64d09c9244",
  "paymentWindowEndsAt": "2023-12-22T10:06:14.889894454Z",
  "expiresAt": "2023-12-22T10:06:14.88990107Z",
  "createdAt": "2023-12-22T09:56:14.889902585Z",
  "lastUpdatedAt": null,
  "paymentStatus": null,
  "paymentId": null,
  "payment": null,
  "txHash": null,
  "requestAmount": null,
  "requestAmountIn": null,
  "requestAmountConverted": null,
  "convertPair": null,
  "convertRate": null,
  "payAmount": null,
  "payerPlatformFee": null,
  "payerFixedPlatformFee": null,
  "payerPercentPlatformFee": null,
  "merchantPlatformFee": null,
  "merchantFixedPlatformFee": 0.1,
  "merchantPercentPlatformFee": 5,
  "processingAmount": null,
  "paidAmount": null,
  "overpaid": false,
  "minLimit": 1,
  "maxLimit": 1000
}
```

The following fields in the response are the most important:

| Field               | Description                                                                                                                                                                                          |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| currency            | Currency of payment                                                                                                                                                                                  |
| blockchain          | Blockchain of payment                                                                                                                                                                                |
| address             | The address end user should pay to                                                                                                                                                                   |
| paymentWindowEndsAt | This timestamp is provided to the user to indicate the payment window's closure. However, Inqud makes a slight extension beyond this time to accommodate potential delays in the blockchain network. |
| minLimit            | Minimum payment amount                                                                                                                                                                               |
| maxLimit            | Maximum payment amount                                                                                                                                                                               |

{% 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-requests/operation/user_crypto-acquiring_create-request).
{% endhint %}
{% endtab %}
{% endtabs %}

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

{% content-ref url="web-hooks/request-web-hook" %}
[request-web-hook](https://docs.inqud.com/crypto-widget/integration/web-hooks/request-web-hook)
{% endcontent-ref %}
