{"id":22576635,"url":"https://github.com/ndolestudio/campay-go-sdk","last_synced_at":"2026-02-20T12:01:27.108Z","repository":{"id":57624140,"uuid":"398057920","full_name":"NdoleStudio/campay-go-sdk","owner":"NdoleStudio","description":"Unofficial Go SDK for campay","archived":false,"fork":false,"pushed_at":"2026-02-05T20:34:41.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-06T06:01:25.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://documenter.getpostman.com/view/2391374/T1LV8PVA","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/NdoleStudio.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-19T19:48:12.000Z","updated_at":"2026-02-05T20:33:42.000Z","dependencies_parsed_at":"2024-06-20T03:19:39.968Z","dependency_job_id":null,"html_url":"https://github.com/NdoleStudio/campay-go-sdk","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/NdoleStudio/campay-go-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NdoleStudio%2Fcampay-go-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NdoleStudio%2Fcampay-go-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NdoleStudio%2Fcampay-go-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NdoleStudio%2Fcampay-go-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NdoleStudio","download_url":"https://codeload.github.com/NdoleStudio/campay-go-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NdoleStudio%2Fcampay-go-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29650503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"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":[],"created_at":"2024-12-08T04:07:24.959Z","updated_at":"2026-02-20T12:01:27.102Z","avatar_url":"https://github.com/NdoleStudio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Campay Go SDK\r\n\r\n[![Build](https://github.com/NdoleStudio/campay-go-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/NdoleStudio/campay-go-sdk/actions/workflows/main.yml)\r\n[![codecov](https://codecov.io/gh/NdoleStudio/campay-go-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/NdoleStudio/campay-go-sdk)\r\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/NdoleStudio/campay-go-sdk/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/NdoleStudio/campay-go-sdk/?branch=main)\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/NdoleStudio/campay-go-sdk)](https://goreportcard.com/report/github.com/NdoleStudio/campay-go-sdk)\r\n[![GitHub contributors](https://img.shields.io/github/contributors/NdoleStudio/campay-go-sdk)](https://github.com/NdoleStudio/campay-go-sdk/graphs/contributors)\r\n[![GitHub license](https://img.shields.io/github/license/NdoleStudio/campay-go-sdk?color=brightgreen)](https://github.com/NdoleStudio/campay-go-sdk/blob/master/LICENSE)\r\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/NdoleStudio/campay-go-sdk)](https://pkg.go.dev/github.com/NdoleStudio/campay-go-sdk)\r\n\r\n\r\nThis package provides a `go` client for interacting with the [CamPay API](https://documenter.getpostman.com/view/2391374/T1LV8PVA#intro)\r\n\r\n## Installation\r\n\r\n`campay-go-sdk` is compatible with modern Go releases in module mode, with Go installed:\r\n\r\n```bash\r\ngo get github.com/NdoleStudio/campay-go-sdk\r\n```\r\n\r\nAlternatively the same can be achieved if you use `import` in a package:\r\n\r\n```go\r\nimport \"github.com/NdoleStudio/campay-go-sdk\"\r\n```\r\n\r\n## Implemented\r\n\r\n- [Token](#token)\r\n  - `POST /token`: Get access token\r\n- [Collect](#collect)\r\n  - `POST /collect`: Request Payment\r\n- [Withdraw](#withdraw)\r\n  - `POST /withdraw`: Withdraw funds to a mobile money account\r\n- [Transaction](#transaction)\r\n  - `GET /transaction/{reference}/`: Get the status of a transaction\r\n- [Utilities](#utilities)\r\n  - `POST /api/utilities/airtime/transfer/`: Transfers airtime to a mobile number\r\n  - `GET /api/utilities/transaction/{reference}/`: Get the status of a transaction\r\n- **Payment Links**\r\n  - `POST /api/get_payment_link/`: Receive payments from your clients using generated links.\r\n- **Account Balance**\r\n  - `GET /api/balance/`: Get Application Balance\r\n\r\n## Usage\r\n\r\n### Initialising the Client\r\n\r\nAn instance of the `campay` client can be created using `New()`.  The `http.Client` supplied will be used to make requests to the API.\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/NdoleStudio/campay-go-sdk\"\r\n\t\"net/http\"\r\n)\r\n\r\nfunc main()  {\r\n\tclient := campay.New(\r\n\t\tcampay.WithAPIUsername(\"\" /* campay API Username */),\r\n\t\tcampay.WithAPIPassword(\"\" /* campay API Password */),\r\n\t\tcampay.WithEnvironment(campay.DevEnvironment),\r\n\t)\r\n}\r\n```\r\n\r\n### Error handling\r\n\r\nAll API calls return an `error` as the last return object. All successful calls will return a `nil` error.\r\n\r\n```go\r\npayload, response, err := campayClient.Token(context.Background())\r\nif err != nil {\r\n  //handle error\r\n}\r\n```\r\n\r\n### Token\r\n\r\nThis handles all API requests whose URL begins with `/token/`\r\n\r\n#### Get access token\r\n\r\n`POST /token/`: Get access token\r\n\r\n```go\r\ntoken, _, err := campayClient.Token(context.Background())\r\n\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Println(token.Token) // e.g eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInVpZCI6Mn0...\r\n```\r\n\r\n### Collect\r\n\r\nThis handles all API requests whose URL begins with `/collect/`\r\n\r\n#### `POST /collect/`: Request Payment\r\n\r\nThis endpoint is used to request payment from users.\r\n\r\n```go\r\ncollectResponse, httpResponse, err := campayClient.Collect(context.Background(), campay.CollectOptions{\r\n    Amount: 100,\r\n    Currency: \"XAF\",\r\n    From: \"2376XXXXXXXX\",\r\n    Description: \"Test\",\r\n    ExternalReference: \"\",\r\n})\r\n\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Prinln(collectResponse.Reference) // e.g 26676007-1c31-46d7-9c71-acb031cf0de4\r\n```\r\n\r\n### Withdraw\r\n\r\nThis handles all API requests whose URL begins with `/withdraw/`\r\n\r\n#### `POST /withdraw`: Withdraw funds to a mobile money account\r\n\r\nWithdraw funds from an app to a mobile money account.\r\n\r\n```go\r\nwithdrawResponse, response, err := client.Withdraw(context.Background(), \u0026WithdrawParams{\r\n    Amount:            100,\r\n    To:                \"2376XXXXXXXX\",\r\n    Description:       \"Test\",\r\n    ExternalReference: nil,\r\n})\r\n\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Println(withdrawResponse.Reference) // e.g 26676007-1c31-46d7-9c71-acb031cf0de4\r\n```\r\n\r\n### Transaction\r\n\r\nThis handles all API requests whose URL begins with `/transaction/`\r\n\r\n#### `GET /transaction/{reference}/`: Get the status of a transaction\r\n\r\nUse this endpoint to check for the status of an initiated transaction.\r\n\r\n```go\r\ntransaction, httpResponse, err := campayClient.Transaction.Get(\r\n\tcontext.Background(),\r\n\t\"bcedde9b-62a7-4421-96ac-2e6179552a1a\"\r\n)\r\n\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Println(transaction.Reference) // e.g 26676007-1c31-46d7-9c71-acb031cf0de4\r\n```\r\n\r\n### Utilities\r\n\r\n#### `POST /api/utilities/airtime/transfer/`: Transfers airtime to a mobile number\r\n\r\n```go\r\ntransaction, httpResponse, err := client.Utilities.AirtimeTransferSync(context.Background(), \u0026AirtimeTransferParams{\r\n  Amount:            \"100\",\r\n  To:                \"237677777777\",\r\n  ExternalReference: \"sample-external-ref\",\r\n})\r\n\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Println(transaction.Reference) // e.g 26676007-1c31-46d7-9c71-acb031cf0de4\r\n```\r\n\r\n#### `GET /api/utilities/transaction/{reference}/`: Get the status of a transaction\r\n\r\n```go\r\ntransaction, httpResponse, err := client.Utilities.AirtimeTransferSync(context.Background(), \"\" /* Transaction reference */)\r\nif err != nil {\r\n    log.Fatal(err)\r\n}\r\n\r\nlog.Println(transaction.Status) // e.g \"SUCCESSFUL\"\r\n```\r\n\r\n## Testing\r\n\r\nYou can run the unit tests for this client from the root directory using the command below:\r\n\r\n```bash\r\ngo test -v\r\n```\r\n\r\n### Security\r\n\r\nIf you discover any security related issues, please email arnoldewin@gmail.com instead of using the GitHub issues.\r\n\r\n## Credits\r\n\r\n- [Acho Arnold](https://github.com/AchoArnold)\r\n- [All Contributors](../../contributors)\r\n\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndolestudio%2Fcampay-go-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndolestudio%2Fcampay-go-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndolestudio%2Fcampay-go-sdk/lists"}