# Orders

This section describes methods for creating orders and obtaining order information

Orders functionality allows you to accept payments in a specified coin and network

## API Interaction Scheme

{% @mermaid/diagram content="sequenceDiagram
Client ->> Merchant: Payment request
Merchant ->> Apollopayment: Creating order
Apollopayment ->> Merchant: Order
Merchant ->> Client: Payment address of payment link

```
Note over Client: Sending coins

Apollopayment -->> Merchant: Payment webhook" %}
```

## Possible statuses

| Status      | Description                                          |
| ----------- | ---------------------------------------------------- |
| `init`      | Order created                                        |
| `error`     | Error during creation or execution                   |
| `processed` | Successful order payment                             |
| `pending`   | Upon receipt of the first payment                    |
| `expired`   | Order lifetime expired                               |
| `partial`   | The warrant expired, but was partially paid          |
| `overpaid`  | The order was paid in excess of the specified amount |

When the status changes or a new transaction arrives, you will be sent a webhook to the URL specified when creating the order.

More information about webhooks can be found in the **Webhooks** section

> #### Attention
>
> Please note that the statuses `processed`, `expired`, `partial`, `overpaid` \*\* are not final\*\*
>
> When processing a webhook, you should separately process the array of received transactions to correctly process the payment amount

## Order lifetime

When creating an order, selects an address from the pool of `PAY_IN` addresses of the organization.\
This address will not be available for other transactions during the entire life of the order.

Depending on the payment network, the minimum and maximum lifetime of an order may vary.

Minimum and maximum values for networks:

| Network       | Minimum value | Maximum value |
| ------------- | ------------- | ------------- |
| `ton`         | 1800          | 43200         |
| `bitcoin`     | 7200          | 43200         |
| `bitcoincash` | 7200          | 43200         |
| `bsc`         | 1800          | 43200         |
| `tron`        | 1800          | 43200         |
| `ethereum`    | 1800          | 43200         |
| `fantom`      | 1800          | 43200         |
| `litecoin`    | 3600          | 43200         |

## Lost transactions

In some cases, the payer may send to a coin address on another network or coin.\
Such transactions will be displayed in a separate `orphanDeposits` field when receiving a webhook\
or receiving order information via API.

You can see these transactions in your personal account in the **Payments -> Orphan Transactions** section.\
In this section, withdrawal of these coins to a third-party address will be available.
