Skip to content
GitHub

Create an Incoming Payment

POST
/incoming-payments

A client MUST create an incoming payment resource before it is possible to send any payments to the wallet address.

When a client creates an incoming payment the receiving Account Servicing Entity generates unique payment details that can be used to address payments to the account and returns these details to the client as properties of the new incoming payment. Any payments received using those details are then associated with the incoming payment.

All of the input parameters are optional.

For example, the client could use the metadata property to store an external reference on the incoming payment and this can be shared with the account holder to assist with reconciliation.

If incomingAmount is specified and the total received using the payment details equals or exceeds the specified incomingAmount, then the receiving Account Servicing Entity MUST reject any further payments and set completed to true.

If an expiresAt value is defined, and the current date and time on the receiving Account Servicing Entity’s systems exceeds that value, the receiving Account Servicing Entity MUST reject any further payments.

Authorizations

Parameters

Header Parameters

Signature-Input
required

The Signature-Input field is a Dictionary structured field containing the metadata for one or more message signatures generated from components within the HTTP message. Each member describes a single message signature. The member’s key is the label that uniquely identifies the message signature within the context of the HTTP message. The member’s value is the serialization of the covered components Inner List plus all signature metadata parameters identified by the label. The following components MUST be included: - “@method” - “@target-uri” - “authorization”. When the message contains a request body, the covered components MUST also include the following: - “content-digest” The keyid parameter of the signature MUST be set to the kid value of the JWK. See ietf-httpbis-message-signatures for more details.

The Signature-Input field is a Dictionary structured field containing the metadata for one or more message signatures generated from components within the HTTP message. Each member describes a single message signature. The member’s key is the label that uniquely identifies the message signature within the context of the HTTP message. The member’s value is the serialization of the covered components Inner List plus all signature metadata parameters identified by the label. The following components MUST be included: - “@method” - “@target-uri” - “authorization”. When the message contains a request body, the covered components MUST also include the following: - “content-digest” The keyid parameter of the signature MUST be set to the kid value of the JWK. See ietf-httpbis-message-signatures for more details.

Signature
required

The signature generated based on the Signature-Input, using the signing algorithm specified in the “alg” field of the JWK.

The signature generated based on the Signature-Input, using the signing algorithm specified in the “alg” field of the JWK.

Request Body required

A subset of the incoming payments schema is accepted as input to create a new incoming payment.

The incomingAmount must use the same assetCode and assetScale as the wallet address.

object
walletAddress
required

URL of a wallet address hosted by a Rafiki instance.

string format: uri
incomingAmount

The maximum amount that should be paid into the wallet address under this incoming payment.

object
value
required

The value is an unsigned 64-bit integer amount, represented as a string.

string format: uint64
assetCode
required

The assetCode is a code that indicates the underlying asset. This SHOULD be an ISO4217 currency code.

string
assetScale
required

The scale of amounts denoted in the corresponding asset code.

integer
<= 255
expiresAt

The date and time when payments into the incoming payment must no longer be accepted.

string format: date-time
metadata

Additional metadata associated with the incoming payment. (Optional)

object
Examples
{
"walletAddress": "https://openpayments.guide/alice/",
"incomingAmount": {
"value": "2500",
"assetCode": "USD",
"assetScale": 2
},
"metadata": {
"externalRef": "INV2022-02-0137"
}
}

Responses

201

Incoming Payment Created

An incoming payment resource with public details.

object
id
required

The URL identifying the incoming payment.

string format: uri
walletAddress
required

The URL of the wallet address this payment is being made into.

string format: uri
completed
required

Describes whether the incoming payment has completed receiving fund.

boolean
incomingAmount

The maximum amount that should be paid into the wallet address under this incoming payment.

object
value
required

The value is an unsigned 64-bit integer amount, represented as a string.

string format: uint64
assetCode
required

The assetCode is a code that indicates the underlying asset. This SHOULD be an ISO4217 currency code.

string
assetScale
required

The scale of amounts denoted in the corresponding asset code.

integer
<= 255
receivedAmount
required

The total amount that has been paid into the wallet address under this incoming payment.

object
value
required

The value is an unsigned 64-bit integer amount, represented as a string.

string format: uint64
assetCode
required

The assetCode is a code that indicates the underlying asset. This SHOULD be an ISO4217 currency code.

string
assetScale
required

The scale of amounts denoted in the corresponding asset code.

integer
<= 255
expiresAt

The date and time when payments under this incoming payment will no longer be accepted.

string format: date-time
metadata

Additional metadata associated with the incoming payment. (Optional)

object
createdAt
required

The date and time when the incoming payment was created.

string format: date-time
updatedAt
required

The date and time when the incoming payment was updated.

string format: date-time
methods
required

The list of payment methods supported by this incoming payment.

Array
unique items
Any of:
object
type
required
string
Allowed values: ilp
ilpAddress
required

The ILP address to use when establishing a STREAM connection.

string
<= 1023 characters /^(g|private|example|peer|self|test[1-3]?|local)([.][a-zA-Z0-9_~-]+)+$/
sharedSecret
required

The base64 url-encoded shared secret to use when establishing a STREAM connection.

string
/^[a-zA-Z0-9-_]+$/
Examples
{
"id": "https://ilp.rafiki.money/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c",
"walletAddress": "https://ilp.rafiki.money/alice/",
"incomingAmount": {
"value": "2500",
"assetCode": "USD",
"assetScale": 2
},
"receivedAmount": {
"value": "0",
"assetCode": "USD",
"assetScale": 2
},
"completed": false,
"expiresAt": "2022-02-03T23:20:50.52Z",
"metadata": {
"externalRef": "INV2022-02-0137"
},
"createdAt": "2022-03-12T23:20:50.52Z",
"updatedAt": "2022-04-01T10:24:36.11Z",
"methods": [
{
"type": "ilp",
"ilpAddress": "g.ilp.iwuyge987y.98y08y",
"sharedSecret": "1c7eaXa4rd2fFOBl1iydvCT1tV5TbM3RW1WLCafu_JA"
}
]
}

401

Authorization required

Headers

WWW-Authenticate
string

The address of the authorization server for grant requests in the format GNAP as_uri=<URI>

403

Forbidden