# Make a Payment

A powerful feature of Raiden is the ability to let you **pay anyone in the network** by using a path of connected payment channels to mediate the payment and not only directly connected nodes. These payments are called **mediated transfers**.

## Pay

Payments are made from the [`payments`](https://raiden-network.gitbook.io/raiden-network/resources/payments#initiate-a-payment) endpoint via a POST request that needs to include:

1. The address of the token you want to pay with as a path parameter.
2. The address of the node receiving your payment as a path parameter.
3. The amount you would like to pay as a body parameter.

```bash
curl -i -X POST \
http://localhost:5001/api/v1/payments/0x9aBa529db3FF2D8409A1da4C9eB148879b046700/0x61C808D82A3Ac53231750daDc13c777b59310bD9 \
-H 'Content-Type: application/json' \
--data-raw '{"amount": "42"}'
```

{% hint style="info" %}
You can provide the body parameter with an additional *identifier* key with a value of your choice. This value can be a number (`"identifier": 42`) or the stringified number (`"identifier": "42"`).

This is optional and the purpose of the identifier is to give dApps built on Raiden a way to tag payments.
{% endhint %}

Your payment will most likely succeed if:

* The path of channels leading from your node to the node receiving your payment has enough capacity.
* All nodes needed to mediate the payment  are online.
* You have enough tokens in the channel from which you intend to pay out the amount specified in the request body.

To get your tokens out of a channel and back on-chain you either have to withdraw the tokens or close the channel.

{% content-ref url="withdraw-tokens" %}
[withdraw-tokens](https://raiden-network.gitbook.io/raiden-network/raiden-api-1/api-tutorial/withdraw-tokens)
{% endcontent-ref %}

{% content-ref url="4-settle-payments-and-close-channels" %}
[4-settle-payments-and-close-channels](https://raiden-network.gitbook.io/raiden-network/raiden-api-1/api-tutorial/4-settle-payments-and-close-channels)
{% endcontent-ref %}

## View payment history

You can view all transactions you've made with a partner node by querying the [`payments`](https://raiden-network.gitbook.io/raiden-network/resources/payments#payment-history) endpoint in a GET request, using the same path parameters as when [making a payment](#pay).

```bash
curl -i \
http://localhost:5001/api/v1/payments/0x9aBa529db3FF2D8409A1da4C9eB148879b046700/0x61C808D82A3Ac53231750daDc13c777b59310bD9
```

In the response you will be able to see all successful payments, all failed payments and all payments you have received.


---

# 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://raiden-network.gitbook.io/raiden-network/raiden-api-1/api-tutorial/3-make-a-payment.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.
