{"id":34197314,"url":"https://github.com/vitaliy-ukiru/go-cryptopay","last_synced_at":"2026-03-09T22:31:31.016Z","repository":{"id":42045810,"uuid":"464747758","full_name":"vitaliy-ukiru/go-cryptopay","owner":"vitaliy-ukiru","description":"Golang wrapper for CryptoPay API","archived":false,"fork":false,"pushed_at":"2022-10-19T20:34:56.000Z","size":83,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T11:59:04.489Z","etag":null,"topics":["api","crypto","crypto-bot","crypto-pay","crypto-pay-api","cryptobot","cryptopay","go"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/vitaliy-ukiru/go-cryptopay","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitaliy-ukiru.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-03-01T04:49:54.000Z","updated_at":"2023-08-12T15:20:24.000Z","dependencies_parsed_at":"2023-01-20T02:30:23.712Z","dependency_job_id":null,"html_url":"https://github.com/vitaliy-ukiru/go-cryptopay","commit_stats":null,"previous_names":["vitaliy-ukiru/go-crypto-pay"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/vitaliy-ukiru/go-cryptopay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-ukiru%2Fgo-cryptopay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-ukiru%2Fgo-cryptopay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-ukiru%2Fgo-cryptopay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-ukiru%2Fgo-cryptopay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitaliy-ukiru","download_url":"https://codeload.github.com/vitaliy-ukiru/go-cryptopay/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-ukiru%2Fgo-cryptopay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30314627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","crypto","crypto-bot","crypto-pay","crypto-pay-api","cryptobot","cryptopay","go"],"created_at":"2025-12-15T17:36:12.632Z","updated_at":"2026-03-09T22:31:31.007Z","avatar_url":"https://github.com/vitaliy-ukiru.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## go-crypto-pay\n[![Go](https://github.com/vitaliy-ukiru/go-crypto-pay/actions/workflows/go.yml/badge.svg)](https://github.com/vitaliy-ukiru/go-crypto-pay/actions/workflows/go.yml)\n\n**[Crypto Pay](http://t.me/CryptoBot/?start=pay)** is a payment system based\non [@CryptoBot](http://t.me/CryptoBot), which allows you to accept payments in cryptocurrency using the\nAPI.\n\nThis library help you to work with **Crypto Pay**\nvia [Crypto Pay API](https://telegra.ph/Crypto-Pay-API-11-25).\n\n## Install\n\n```shell\ngo get -u github.com/vitaliy-ukiru/go-cryptopay\n```\n\n## Documentation\n\nFor start, you need to create your application and get an API token.\nOpen [@CryptoBot](http://t.me/CryptoBot?start=pay)\nor [@CryptoTestnetBot](http://t.me/CryptoTestnetBot?start=pay) (for testnet), send a command `/pay` to\ncreate a new app and get API Token.\n\nIn this library, the high-level is the `Client`.  \nInternally, it calls the `ApiCore` methods, which is lower-level and is essentially a gateway for API\nrequests. The `Client` methods, in addition to the usual errors, can return an api error `(ApiError)`. If\nyou want to check whether the received error is such, call the `GetApiError` function.\n\n```go\nif apiErr := cryptopay.GetApiError(err); apiErr != nil {\n// handling error of api. \n// apiErr is *ApiError\n}\n```\n\n### Configure NewClient\n\n- Token - token of you app.\n- ApiHost - url to api host. _Default mainnet_.\n- HttpClient - client for make requests. _Default `http.DefaultClient`_.\n- Webhook - webhook configure\n    - OnError - handler for error handling in webhook.\n    - DefaultHandler - set of default handlers. _Default empty_.\n\n### Networks in CryptoPay:\n\n| Net     | Bot                                                          | Hostname                       | Code reference          |\n|---------|--------------------------------------------------------------|--------------------------------|-------------------------|\n| mainnet | [@CryptoBot](https://t.me/CryptoBot?start=pay)               | https://pay.crypt.bot/         | `cryptopay.MainNetHost` |\n| testnet | [@CryptoTestnetBot](https://t.me/CryptoTestnetBot?start=pay) | https://testnet-pay.crypt.bot/ | `cryptopay.TestNetHost` |\n\n### Webhooks\n\nTo get started, send `/pay` command to bot, choose \"My Apps\", select application, open \"Webhooks\" and set\nyour endpoint.\n\nTo work with webhooks, you need to start the server yourself and install `Webhook.ServeHTTP` as a handler\nto the endpoint. If you are running a \"net/http\" server, you can pass the `Webhook` as `http.Handler`\ntype. But if you don't use std server, see the [Adaptation](#Webhook-Adaptation) section.\n\n## Examples\n\n\u003cdetails\u003e\n\u003csummary\u003egetMe\u003c/summary\u003e\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/vitaliy-ukiru/go-cryptopay\"\n)\n\nfunc main() {\n  client := cryptopay.NewClient(cryptopay.ClientSettings{\n    Token:   \"your_token_here\",\n    ApiHost: cryptopay.TestNetHost,\n  })\n  app, err := client.GetMe()\n  if err != nil {\n    panic(err)\n  }\n  fmt.Printf(\n    \"app_id=%d; name=%q; payment_bot=%q\",\n    app.Id,\n    app.Name,\n    app.PaymentBotUsername,\n  )\n\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003etransfer\u003c/summary\u003e\n\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/vitaliy-ukiru/go-cryptopay\"\n)\n\nfunc main() {\n\tclient := cryptopay.NewClient(cryptopay.ClientSettings{\n\t\tToken: \"your_token\",\n\t})\n\ttransfer, err := client.DoTransfer(-1, cryptopay.USDT, 100, \"generate unique data\", cryptopay.DoTransferOptions{\n\t\tComment: \"You winner!\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Transfer completed at %s\", transfer.CompletedAt.Format(time.RFC850))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ewebhook\u003c/summary\u003e\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/vitaliy-ukiru/go-cryptopay\"\n)\n\nfunc main() {\n\tclient := cryptopay.NewClient(cryptopay.ClientSettings{\n\t\tToken: \"your_token\", // token required for webhooks, because using for verification updates\n\t\tWebhook: cryptopay.WebhookSettings{\n\t\t\tOnError: func(_ *http.Request, err error) {\n\t\t\t\tpanic(err)\n\t\t\t},\n\t\t},\n\t})\n\tclient.OnInvoicePaid(func(update *cryptopay.WebhookUpdate) {\n\t\tinvoice := update.Payload\n\t\tfmt.Printf(\n\t\t\t\"Invoice № %d for %s %s was paid on %s\",\n\t\t\tinvoice.Id,\n\t\t\tinvoice.Amount,\n\t\t\tinvoice.Asset,\n\t\t\tinvoice.PaidAt.Format(time.RFC850))\n\t})\n}\n```\n\n\u003c/details\u003e\n\n## Webhook Adaptation\n\nIf you use other router you can adapt. For this you must create handler that call `ServeHTTP` method.\n\nFor [gin-gonic/gin](https://github.com/gin-gonic/gin):\n\n```go\n//  router is gin.Engine\nrouter.POST(\"/path/\", func (c *gin.Context) {\n    webhook.ServerHTTP(http.ResponseWriter(c.Writer), c.Request)\n})\n```\n\nFor [julienschmidt/httprouter](https://github.com/julienschmidt/httprouter):\n\n```go\n// router is httprouter.Router.\nrouter.POST(\"/path\", func (w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n    webhook.ServerHTTP(w, r)\n})\n```\n\nFor [gorilla/mux](https://github.com/gorilla/mux)\n\n```go\n// router is mux.Router\nrouter.Handle(\"/path\", webhook)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaliy-ukiru%2Fgo-cryptopay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitaliy-ukiru%2Fgo-cryptopay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaliy-ukiru%2Fgo-cryptopay/lists"}