# xMoney Crypto API

The xMoney Crypto API allows merchants to integrate cryptocurrency payments into their platforms. It follows RESTful principles and uses JSON:API specifications. 

Key features:

* Resource-oriented URLs
* JSON responses
* Standard HTTP response codes and verbs

API keys are used for authentication to ensure secure communication. Webhooks are supported for real-time payment notifications.


Version: 1.1.0
License: Apache 2.0

## Servers

Production server (live)
```
https://merchants.api.crypto.xmoney.com/api
```

Sandbox server (test)
```
https://merchants.api.sandbox.crypto.xmoney.com/api
```

## Security

### ApiKey

Authenticate requests using your API key. 

**Key format:**

* Production keys: `u_live_XXXXXXXXXXXXXXXXXXXXXXXX`
* Sandbox keys: `u_test_XXXXXXXXXXXXXXXXXXXXXXXX`

Include the API key in the `Authorization` header of every request as `Bearer <api-key>`.

**Example:** `Authorization: Bearer u_live_XXXXXXXXXXXXXXXXXXXXXXXX`


Type: apiKey
In: header
Name: Authorization

## Download OpenAPI description

[xMoney Crypto API](https://docs.xmoney.com/_bundle/crypto_api/reference.yaml)

## Order

Operations related to managing orders.

### Create an order

 - [POST /stores/orders](https://docs.xmoney.com/crypto_api/reference/order/create-an-order.md): Creates a new order for payment processing and returns a URL where the buyer can complete the payment.

### List all orders of the merchant

 - [GET /stores/orders](https://docs.xmoney.com/crypto_api/reference/order/listorders.md)

### Retrieve an order

 - [GET /stores/orders/{id}](https://docs.xmoney.com/crypto_api/reference/order/retrieve-an-order.md): Retrieve the details of an existing order using its unique identifier.

## Refund

Operations related to proposing and retrieving refunds.

### Creates a refund proposal

 - [POST /stores/refund/{payment_id}](https://docs.xmoney.com/crypto_api/reference/refund/createpaymentrefundproposal.md): As a merchant you can only propose refunds; it is ultimately the buyer's decision to either accept or reject it (within a reasonable timeframe).

The following rules apply when proposing a refund:
* Refunds must be enabled for your merchant account.
* There can only be one active refund per payment. A new proposal is only
  allowed if the previous one was rejected.

* The proposed amount must be at least 0.01 and cannot exceed the
  original payment total.

* Refunds are not allowed for payments older than 3 months.
* Offramp payments cannot be refunded.
* A proposal that the buyer does not accept expires after 30 days, after
  which its status becomes expired.

### Returns a refund for the given payment, if there is one

 - [GET /stores/refund/{payment_id}](https://docs.xmoney.com/crypto_api/reference/refund/getpaymentrefund.md)

## Currency

Operations related to the currencies a store accepts.

### List the store's available currencies

 - [GET /stores/available_currencies](https://docs.xmoney.com/crypto_api/reference/currency/listavailablecurrencies.md): Returns the cryptocurrency and blockchain-network pairs that the store accepts. The list depends on the currencies enabled for your store. Common pairs include BTC on BTC, ETH on ETH, USDC on ETH, USDT on ETH, and EGLD on MultiversX.

## Exchange rate

Operations related to exchange-rate quotes.

### Create an exchange rate quote

 - [POST /stores/exchange_rates](https://docs.xmoney.com/crypto_api/reference/exchange-rate/createexchangerate.md): Creates a short-lived (60 second) exchange-rate quote between two currencies. For crypto quotes, from must be a crypto currency the store accepts and to must be a supported settlement currency.

## Session

Operations related to exchanging credentials for an API key.

### Exchange credentials for an API key

 - [POST /stores/session](https://docs.xmoney.com/crypto_api/reference/session/createsession.md): Exchanges a store's client_id and client_secret for its API key, which can then be used as the Bearer token for authenticated requests.

