{"id":25716322,"url":"https://github.com/interledgerjs/ilp-spsp-invoice-server","last_synced_at":"2026-03-17T01:50:48.816Z","repository":{"id":39338568,"uuid":"119621725","full_name":"interledgerjs/ilp-spsp-invoice-server","owner":"interledgerjs","description":"SPSP server with invoices, as a proof of concept","archived":false,"fork":false,"pushed_at":"2022-12-30T17:48:13.000Z","size":732,"stargazers_count":3,"open_issues_count":14,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T09:51:22.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interledgerjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-31T02:12:17.000Z","updated_at":"2020-11-01T20:16:11.000Z","dependencies_parsed_at":"2023-01-31T12:25:13.828Z","dependency_job_id":null,"html_url":"https://github.com/interledgerjs/ilp-spsp-invoice-server","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/interledgerjs/ilp-spsp-invoice-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp-spsp-invoice-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp-spsp-invoice-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp-spsp-invoice-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp-spsp-invoice-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interledgerjs","download_url":"https://codeload.github.com/interledgerjs/ilp-spsp-invoice-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp-spsp-invoice-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272187887,"owners_count":24888687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-25T14:52:59.529Z","updated_at":"2026-03-17T01:50:48.790Z","avatar_url":"https://github.com/interledgerjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ILP SPSP Invoice Server\n\u003e SPSP server that supports invoices\n\n- [Usage](#usage)\n- [Environment Variables](#environment-variables)\n- [API](#api)\n  - [Create an Invoice](#create-an-invoice)\n  - [Query an Invoice](#query-an-invoice)\n  - [Webhooks](#webhooks)\n\n## Usage\n\nMake sure you have [moneyd](https://github.com/interledgerjs/moneyd) running. Then start the SPSP Invoice Server:\n\n```sh\nSPSP_LOCALTUNNEL=true SPSP_LOCALTUNNEL_SUBDOMAIN=mysubdomain npm start\n```\nCreate an invoice with an amount due of 10 XRP. `amount`, `assetCode`, and `assetScale` are mandatory, you may add additional fields. See [Create an Invoice](#create-an-invoice) for more information. Here, we add a reason for the invoice.\n\n```sh\nhttp POST mysubdomain.localtunnel.me amount=10000000 assetCode=XRP assetScale=6 reason=lunch Authorization:\"Bearer test\"\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Length: 73\nContent-Type: application/json; charset=utf-8\nDate: Thu, 16 May 2019 16:37:52 GMT\nServer: nginx/1.10.1\n\n{\n    \"invoice\": \"$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525\"\n}\n```\nQuery the invoice:\n\n```sh\nilp-spsp query -p '$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525'\n\n{\n  \"destinationAccount\": \"private.moneyd.local.QGF2HflZ81d1uF1qXW9s-AjWtC23XY4tF-jZHhBdF_I.4eRM1t--cUUQqV5v8tsB0H9S~ef6e2a39-ba3c-a5cc-0849-9730ed56d525\",\n  \"sharedSecret\": \"4v82v2ho4b3DYxqhBKRWncQdIRePcB6/s8Gksc6EH/4=\",\n  \"push\": {\n    \"balance\": \"0\",\n    \"invoice\": {\n      \"amount\": \"10000000\",\n      \"asset\": {\n        \"code\": \"XRP\",\n        \"scale\": \"6\"\n      },\n      \"additionalFields\": {\n        \"reason\": \"lunch\"\n      }\n    }\n  },\n  \"contentType\": \"application/spsp4+json\"\n}\n```\n\nPay the invoice. Note that the amount depends on moneyd's uplink. Here, we assume XRP with a scale of 9:\n```sh\nilp-spsp send -a 10000000000 -p '$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525'\n\npaying 10000000000 to \"$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525\"...\nsent 10000000000 units!\n```\n\nQuery again:\n```sh\nilp-spsp query -p '$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525'\n\n{\n  \"destinationAccount\": \"private.moneyd.local.QGF2HflZ81d1uF1qXW9s-AjWtC23XY4tF-jZHhBdF_I.4eRM1t--cUUQqV5v8tsB0H9S~ef6e2a39-ba3c-a5cc-0849-9730ed56d525\",\n  \"sharedSecret\": \"4v82v2ho4b3DYxqhBKRWncQdIRePcB6/s8Gksc6EH/4=\",\n  \"push\": {\n    \"balance\": \"10000000\",\n    \"invoice\": {\n      \"amount\": \"10000000\",\n      \"asset\": {\n        \"code\": \"XRP\",\n        \"scale\": \"6\"\n      },\n      \"additionalFields\": {\n        \"reason\": \"lunch\"\n      }\n    }\n  },\n  \"contentType\": \"application/spsp4+json\"\n}\n```\n\n## Environment Variables\n\n| Name | Default | Description |\n|:---|:---|:---|\n| `SPSP_PORT` | `6000` | port to listen on locally. |\n| `SPSP_LOCALTUNNEL` | | If this variable is defined, `SPSP_PORT` will be proxied by localtunnel under `SPSP_LOCALTUNNEL_SUBDOMAIN`. |\n| `SPSP_LOCALTUNNEL_SUBDOMAIN` | | Subdomain to forward `SPSP_PORT` to. Must be defined if you set `SPSP_LOCALTUNNEL` |\n| `SPSP_DB_PATH` | | Path for leveldb database. Uses in-memory database if unspecified. |\n| `SPSP_AUTH_TOKEN` | `test` | Bearer token for creating invoices and receiving webhooks. |\n| `SPSP_HOST` | localhost or localtunnel | Host to include in payment pointers |\n\n## API\n\n### Create an Invoice\n\n```http\nPOST /\n```\n\nCreate an invoice.\n\n#### Request\n\n- `amount` - Invoice amount in units of `assetCode` and `assetScale`.\n- `assetCode` - Asset code to identify the invoice's currency. Currencies that have [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes should use those.\n- `assetScale` - Scale of `amount` denoted in `assetCode` (e.g. an `amount` of \"1000\" with an `assetScale` of 2 translates to 10.00 units of `assetCode`).\n- `webhook` - (Optional) Webhook to `POST` to after the invoice is fully paid. See [Webhooks](#webhooks)\n- `\"anything\"` - (Optional) Any additional fields can just be passed as named values, e.g. `reason=lunch`.\n\n#### Response\n\n- `invoice` - Payment pointer created for this invoice.\n\n### Query an Invoice\n\n```http\nGET /:invoice_id\n```\n\nSPSP endpoint for the invoice with `:invoice_id`. The payment pointer\nreturned by [Create an Invoice](#create-an-invoice) resolves to this endpoint.\n\n### Webhooks\n\nWhen you [Create an Invoice](#create-an-invoice) and specify a webhook, it will\ncall the specified webhook when the invoice is paid. The request is a `POST` with\n\n```http\nAuthorization: Bearer \u003cSPSP_AUTH_TOKEN\u003e\n\n{\n  \"balance\": 1000000,\n  \"amount\": 1000000,\n  \"pointer\": \"$mysubdomain.localtunnel.me/ef6e2a39-ba3c-a5cc-0849-9730ed56d525\",\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Filp-spsp-invoice-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterledgerjs%2Filp-spsp-invoice-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Filp-spsp-invoice-server/lists"}