Payments

The payment endpoint is used for transferring tokens to another node. You can send the desired amount of tokens by providing the address of the token and the address of the receiving node.

Payments Resource Overview

HTTP Method

Resource

Description

GET

/api/<version>/payments/<token_address>

/<target_address>

Payment history

POST

/api/<version>/payments/<token_address>

/<target_address>

Initiate a payment

Payment Resource Details

get
Payment History

http://localhost:5001/api/v1/payments/0x0f11...b1ED/0x8264...5ba7
When querying the payment history the response will include: - "EventPaymentSentSuccess" for successful payments - "EventPaymentSentFailed" for failed payments - "EventPaymentReceivedSuccess" for received payments
Request
Response
Path Parameters
version
required
string
Version of the API
token_address
optional
string
Address of a token, will filter response list according to token_address
target_address
optional
string
Address of the receiving node, will filter response list according to target_address
200: OK
Successful query
[
{
"event": "EventPaymentSentSuccess",
"amount": 20,
"target": "0x82641569b2062B545431cF6D7F0A418582865ba7",
"identifier": 3,
"log_time": "2018-10-30T07:10:13.122"
},
{
"target": "0x82641569b2062B545431cF6D7F0A418582865ba7",
"event": "EventPaymentSentFailed",
"log_time": "2018-10-30T07:04:22.293",
"reason": "there is no route available"
},
{
"event": "EventPaymentReceivedSuccess",
"amount": 5,
"initiator": "0x82641569b2062B545431cF6D7F0A418582865ba7",
"identifier": 1,
"log_time": "2018-10-30T07:03:52.193"
}
]
404: Not Found
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
409: Conflict
An invalid token address has been provided
500: Internal Server Error
Internal Raiden node error

post
Initiate a Payment

http://localhost:5001/api/v1/payments/0x2a65...8226/0x61C8...0bD9
The request might take some time and will only return once the payment either succeeds or fails.
Request
Response
Path Parameters
version
required
string
Version of the API
token_address
required
string
Address of a token
target_address
required
string
Address of the receiving node
Body Parameters
amount
required
integer
Amount of tokens to be sent
identifier
optional
integer
Integer for identifying the payment
200: OK
Successful payment
{
"initiator_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
"target_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
"token_address": "0x2a65Aca4D5fC5B5C859090a6c34d164135398226",
"amount": 200,
"identifier": 42
}
400: Bad Request
The provided JSON is in some way incorrect
402: Payment Required
The payment can't start due to insufficient balande
404: Not Found
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
408: Request Time-out
A timeout happened during the payment
409: Conflict
An invalid token and/or target address has been provided
An invalid token amount has been provided
There is no path to the receiving node
The identifier is already in use for a different payment
500: Internal Server Error
Internal Raiden node error

Example request body:

{
"amount": 200,
"identifier" 42
}

Failing Payments

A payment can fail due to:

  • The secret for opening the hashlock not being revealed in time and the lock expires

  • The target node being offline

  • The channels leading to the target node not having enough settle timeout and reveal_timeout

  • The funds not being enough