Links

Usage

Basic wallet api
The wallet is controlled by a JSON api which provides the interface for operation. This should only be accessed from a local machine or a secure front end, since it's not protected by any credential requirements.

Balance

GET /api/v1/balance
Sums all spendable satoshis under the wallet's control.
Response 200 OK
{
"balance": 1000
}

Invoices

Creating an invoice is a prerequisite for accepting payment.
POST /api/v1/invoices
Request
{
"description": "string",
"expiresAt": "string",
"reference": "string",
"satoshis": 1000
}
Response 201 OK
{
"id": "13MzVgA",
"reference": "ref",
"description": "description",
"satoshis": 1000,
"expiresAt": "2022-01-26T12:11:16.267690974Z",
"paymentReceivedAt": null,
"refundTo": null,
"refundedAt": null,
"state": "pending",
"createdAt": "2022-01-25T12:11:16.267690974Z",
"updatedAt": "2022-01-25T12:11:16Z",
"deletedAt": null
}
GET /api/v1/invoices/{id}
200 OK
{
"id": "{id}",
"reference": "ref",
"description": "description",
"satoshis": 2000,
"expiresAt": "2022-01-26T12:11:16.267690974Z",
"paymentReceivedAt": null,
"refundTo": null,
"refundedAt": null,
"state": "pending",
"createdAt": "2022-01-25T12:11:16.267690974Z",
"updatedAt": "2022-01-25T12:11:16Z",
"deletedAt": null
}
DELETE /api/v1/invoices/{id}
Response 204 OK no content
GET /api/v1/invoices
Response 200 OK
[
{
"id": "13MzVgA",
"reference": "ref",
"description": "description",
"satoshis": 2000,
"expiresAt": "2022-01-26T12:11:16.267690974Z",
"paymentReceivedAt": null,
"refundTo": null,
"refundedAt": null,
"state": "pending",
"createdAt": "2022-01-25T12:11:16.267690974Z",
"updatedAt": "2022-01-25T12:11:16Z",
"deletedAt": null
},
{
"id": "2dH24s32",
"reference": "ref",
"description": "description",
"satoshis": 2000,
"expiresAt": "2022-01-26T13:11:16.267690974Z",
"paymentReceivedAt": null,
"refundTo": null,
"refundedAt": null,
"state": "pending",
"createdAt": "2022-01-25T13:11:16.267690974Z",
"updatedAt": "2022-01-25T13:11:16Z",
"deletedAt": null
}
]

Sending Payments

POST /api/v1/pay
Request
{
"payToURL": "https://infra.bitcoinsv.io/api/v1/payment/1o9GgvP"
}
Response 200 OK
{
"id": "1o9GgvP",
"tx_id": "0d8102845954ed8802a42a5c90ee1e30006a450e2a91a1858f9f4a039e168006",
"memo": "note of some sort",
"peer_channel": {
"host": "https://peer.bitcoinsv.io/",
"path": "/peerchannels",
"id": "k8xWqbMFSmWWtHofHpt1ny30YmTa_TpM00-Fyh6tUYFSqEGXHVNHzEGmlXOVGvGzY-6GuWg4UNpxj0pwipaEAA",
"token": "4pjgAt3V55x5s1QHMHcopffyb78ZJyziJZ5vK6TvlJZDUQs9ptiMX7XWQNP2JIy3RzqZDGaQtK1v_uFJ02pXkg"
}
}

Users

POST /api/v1/users
Request
{
"name": "Epictetus",
"email": "[email protected]",
"avatar": "https://thispersondoesnotexist.com/image",
"address": "1 Athens Avenue",
"phoneNumber": "0800-call-me"
}
Response 201 OK
{
"id": 1,
"name": "Epictetus",
"email": "[email protected]",
"avatar": "https://thispersondoesnotexist.com/image",
"address": "1 Athens Avenue",
"phoneNumber": "0800-call-me",
"extendedData": {
"pki": "{publickey}",
}
}
GET /api/v1/users/{id}
Response 200 OK
{
"id": 1,
"name": "Epictetus",
"email": "[email protected]",
"avatar": "https://thispersondoesnotexist.com/image",
"address": "1 Athens Avenue",
"phoneNumber": "0800-call-me",
"extendedData": {
"pki": "{publickey}",
}
}

Receiving Payments

The wallet exposes Direct Payment Protocol endpoints which can be exposed to allow receiving payments to invoices. You can read the specific message structure in the dedicated section.