Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ndolestudio/coinpayments-go
Unofficial Go API for CoinPayments
https://github.com/ndolestudio/coinpayments-go
coinpayments coinpayments-api
Last synced: about 2 months ago
JSON representation
Unofficial Go API for CoinPayments
- Host: GitHub
- URL: https://github.com/ndolestudio/coinpayments-go
- Owner: NdoleStudio
- License: mit
- Created: 2022-05-21T09:50:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T13:57:06.000Z (over 1 year ago)
- Last Synced: 2024-06-21T03:11:09.044Z (7 months ago)
- Topics: coinpayments, coinpayments-api
- Language: Go
- Homepage: https://www.coinpayments.net/apidoc-intro
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coinpayments-go
[![Build](https://github.com/NdoleStudio/coinpayments-go/actions/workflows/main.yml/badge.svg)](https://github.com/NdoleStudio/coinpayments-go/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/NdoleStudio/coinpayments-go/branch/main/graph/badge.svg)](https://codecov.io/gh/NdoleStudio/coinpayments-go)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/NdoleStudio/coinpayments-go/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/NdoleStudio/coinpayments-go/?branch=main)
[![Go Report Card](https://goreportcard.com/badge/github.com/NdoleStudio/coinpayments-go)](https://goreportcard.com/report/github.com/NdoleStudio/coinpayments-go)
[![GitHub contributors](https://img.shields.io/github/contributors/NdoleStudio/coinpayments-go)](https://github.com/NdoleStudio/coinpayments-go/graphs/contributors)
[![GitHub license](https://img.shields.io/github/license/NdoleStudio/coinpayments-go?color=brightgreen)](https://github.com/NdoleStudio/coinpayments-go/blob/master/LICENSE)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/NdoleStudio/coinpayments-go)](https://pkg.go.dev/github.com/NdoleStudio/coinpayments-go)This package provides a generic `go` client template for the CoinPayments HTTP API
## Installation
`coinpayments-go` is compatible with modern Go releases in module mode, with Go installed:
```bash
go get github.com/NdoleStudio/coinpayments-go
```Alternatively the same can be achieved if you use `import` in a package:
```go
import "github.com/NdoleStudio/coinpayments-go"
```## Implemented
- [Payments](#payments)
- `create_transaction`: Create Transaction## Usage
### Initializing the Client
An instance of the client can be created using `New()`.
```go
package mainimport (
"github.com/NdoleStudio/coinpayments-go"
)func main() {
client := coinpayments.New(
coinpayments.WithAPIKey(/* API Key */),
coinpayments.WithAPISecret(/* API Secret */),
)
}
```### Error handling
All API calls return an `error` as the last return object. All successful calls will return a `nil` error.
```go
status, response, err := client.Payments.CreatePayment(context.Background())
if err != nil {
//handle error
}
```### Payments
#### `create_transaction`: Create Transaction
```go
transaction, response, err := client.Payments.CreatePayment(context.Background(), &CreatePaymentRequest{
Amount: "1.00000000",
OriginalCurrency: "USD",
SendingCurrency: "USD",
BuyerEmail: "[email protected]",
}
)if err != nil {
log.Fatal(err)
}log.Println(transaction.Error) // ok
```## Testing
You can run the unit tests for this client from the root directory using the command below:
```bash
go test -v
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details