{"id":13412854,"url":"https://github.com/matm/go-nowpayments","last_synced_at":"2025-03-14T18:32:34.017Z","repository":{"id":65001087,"uuid":"557305455","full_name":"matm/go-nowpayments","owner":"matm","description":"Go library for the crypto NOWPayments API","archived":false,"fork":false,"pushed_at":"2023-01-24T13:02:29.000Z","size":47,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-30T20:43:01.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-25T12:58:01.000Z","updated_at":"2024-04-03T11:42:14.000Z","dependencies_parsed_at":"2023-02-13T21:25:24.006Z","dependency_job_id":null,"html_url":"https://github.com/matm/go-nowpayments","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matm%2Fgo-nowpayments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matm%2Fgo-nowpayments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matm%2Fgo-nowpayments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matm%2Fgo-nowpayments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matm","download_url":"https://codeload.github.com/matm/go-nowpayments/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221495313,"owners_count":16832458,"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","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":"2024-07-30T20:01:30.102Z","updated_at":"2024-10-26T04:31:20.039Z","avatar_url":"https://github.com/matm.png","language":"Go","funding_links":[],"categories":["金融","Financial"],"sub_categories":["检索及分析资料库","Search and Analytic Databases"],"readme":"# NOWPayments Go Library\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/matm/go-nowpayments.svg)](https://pkg.go.dev/github.com/matm/go-nowpayments)\n[![Go Report Card](https://goreportcard.com/badge/github.com/matm/go-nowpayments)](https://goreportcard.com/report/github.com/matm/go-nowpayments)\n[![codecov](https://codecov.io/gh/matm/go-nowpayments/branch/main/graph/badge.svg?token=AP16BAZR68)](https://codecov.io/gh/matm/go-nowpayments)\n\nThis is an unofficial Go library for the [crypto NOWPayments API](https://documenter.getpostman.com/view/7907941/S1a32n38#84c51632-01ad-49c0-96f8-fb4b5ad2b24a) version 1.\n\nNote that the current implementation mostly focuses on the payments API for now:\n\nTopic|Endpoint|Package.Method|Implemented\n---|:---|:---|:---:\n[Recurring payments](https://documenter.getpostman.com/view/7907941/S1a32n38#689df54e-9f43-42b3-bfe8-9bcca0444a6a)|||No\n[Billing (sub-partner)](https://documenter.getpostman.com/view/7907941/S1a32n38#a523b89b-40b7-4afe-b940-043d434a6c80)|||No\n[Payments](https://documenter.getpostman.com/view/7907941/S1a32n38#84c51632-01ad-49c0-96f8-fb4b5ad2b24a)|||Yes\n||Get estimated price|[payments.EstimatedPrice(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#EstimatedPrice)|:heavy_check_mark:\n||Get the minimum payment amount|[payments.MinimumAmount(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#MinimumAmount)|:heavy_check_mark:\n||Get payment status|[payments.Status()](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#Status)|:heavy_check_mark:\n||Get list of payments|[payments.List(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#List)|:heavy_check_mark:\n||Get/Update payment estimate|[payments.RefreshEstimatedPrice(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#RefreshEstimatedPrice)|:heavy_check_mark:\n||Create invoice|[payments.NewInvoice(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#NewInvoice)|:heavy_check_mark:\n||Create payment|[payments.New(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#New)|:heavy_check_mark:\n||Create payment from invoice|[payments.NewFromInvoice(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/payments#NewFromInvoice)|:heavy_check_mark:\n[Currencies](https://documenter.getpostman.com/view/7907941/S1a32n38#cb80ccdc-8f7c-426c-89df-1ed2241954a5)|||Yes\n||Get available currencies|[currencies.All()](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/currencies#All)|:heavy_check_mark:\n||Get available checked currencies|[currencies.Selected()](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/currencies#Selected)|:heavy_check_mark:\n[Payouts](https://documenter.getpostman.com/view/7907941/S1a32n38#138ee72b-4c4f-40d0-a565-4a1e907f4d94)|||No\n[API status](https://documenter.getpostman.com/view/7907941/S1a32n38#9998079f-dcc8-4e07-9ac7-3d52f0fd733a)|||Yes\n||Get API status|[core.Status()](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/core#Status)|:heavy_check_mark:\n[Authentication](https://documenter.getpostman.com/view/7907941/S1a32n38#174cd8c5-5973-4be7-9213-05567f8adf27)|||Yes\n||Authentication|[core.Authenticate(...)](https://pkg.go.dev/github.com/matm/go-nowpayments/pkg/core#Authenticate)|:heavy_check_mark:\n\n## Installation\n\n```bash\n$ go get github.com/matm/go-nowpayments@v1.0.4\n```\n\n## Usage\n\nJust load the config with all the credentials from a file or using a `Reader` then display the NOWPayments' API status and the last 2 payments\nmade with:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/matm/go-nowpayments/config\"\n\t\"github.com/matm/go-nowpayments/core\"\n\t\"github.com/matm/go-nowpayments/payments\"\n)\n\nfunc main() {\n      // Load sandbox's credentials.\n\terr := config.Load(strings.NewReader(`\n{\n      \"server\": \"https://api-sandbox.nowpayments.io/v1\",\n      \"login\": \"some_email@domain.tld\",\n      \"password\": \"some_password\",\n      \"apiKey\": \"some_api_key\"\n}\n`))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Use the server URL defined above.\n\tcore.UseBaseURL(core.BaseURL(config.Server()))\n\t// Use default HTTP client.\n\tcore.UseClient(core.NewHTTPClient())\n\n\tst, err := core.Status()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"API status:\", st)\n\n\tconst limit = 2\n\tps, err := payments.List(\u0026payments.ListOption{\n\t\tLimit: limit,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Last %d payments: %v\\n\", limit, ps)\n}\n```\n\n## CLI Tool\n\nA `np` tool is available to easily play with the payments API from the command line. Please make sure to target the sandbox API server in this case.\n\nCan be installed with:\n```bash\n$ go install github.com/matm/go-nowpayments/cmd/np@latest\n```\n\nThe following commands are available:\n```\nUsage of np:\n  -a float\n        pay amount for new payment/invoice (default 2)\n  -c    show list of selected currencies\n  -case string\n        payment's case (sandbox only) (default \"success\")\n  -debug\n        turn debugging on\n  -f string\n        JSON config file to use\n  -i    new invoice\n  -l    list all payments\n  -n    new payment\n  -p string\n        status of payment ID\n  -pc string\n        crypto currency to pay in (default \"xmr\")\n  -pi string\n        new payment from invoice ID\n```\n\nIn order to work, `np` expects a JSON config file provided as an argument, like\n```\n$ np -f conf.json -c\n```\nto list all crypto currencies available for payments.\n\nThe JSON config file looks like\n```json\n{\n  \"server\": \"https://api-sandbox.nowpayments.io/v1\",\n  \"login\": \"your_email_adresse\",\n  \"password\": \"some_password\",\n  \"apiKey\": \"the API key to use\"\n}\n```\n\n- `server` is the path to the API server, i.e. one of\n  - sandbox: `https://api-sandbox.nowpayments.io/v1`\n  - production: `https://api.nowpayments.io/v1`\n- `login` and `password` are your NOWPayments credentials\n- `apiKey` is one API key generated in your admin account\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatm%2Fgo-nowpayments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatm%2Fgo-nowpayments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatm%2Fgo-nowpayments/lists"}