https://github.com/zhooravell/go-solidgate
SolidGate golang client
https://github.com/zhooravell/go-solidgate
go golang golang-library http solidgate
Last synced: 5 months ago
JSON representation
SolidGate golang client
- Host: GitHub
- URL: https://github.com/zhooravell/go-solidgate
- Owner: zhooravell
- License: mit
- Created: 2019-04-26T16:58:16.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-22T14:22:27.000Z (almost 7 years ago)
- Last Synced: 2023-03-21T22:25:37.623Z (about 3 years ago)
- Topics: go, golang, golang-library, http, solidgate
- Language: Go
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SolidGate golang client
=======================
> SolidGate api golang wrapper
[![codecov][scrutinizer-image]][scrutinizer-link] [![License][license-image]][license-link] [![Build Status][travis-image]][travis-link] [![codecov][codecov-image]][codecov-link]

## Installing
``` sh
$ go get github.com/zhooravell/go-solidgate
```
``` sh
$ dep ensure -add github.com/zhooravell/go-solidgate
```
## Using
Initialize client
``` go
merchantID := "merchantID"
privateKey := "privateKey"
solidGateClient := solidgate.NewSolidGateClient(
merchantID,
&http.Client{},
solidgate.NewSha512Signer(merchantID, []byte(privateKey)),
"https://pay.signedpay.com/api/v1",
)
```
InitPayment transaction
``` go
ip := net.ParseIP("8.8.8.8")
email, _ := mail.ParseAddress("jondou@gmail.com")
initPaymentRequest := solidgate.NewInitPaymentRequest(
1050,
"USD",
email,
"UKR",
&ip,
"Premium package",
"777",
"WEB",
)
initPaymentResponse, err := solidGateClient.InitPayment(context.Background(), initPaymentRequest)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", initPaymentResponse)
```
Charge transaction
``` go
ip := net.ParseIP("8.8.8.8")
email, _ := mail.ParseAddress("jondou@gmail.com")
chargeRequest := solidgate.NewChargeRequest(
1050,
"USD",
"123",
"01",
"2024",
"JOHN SNOW",
"4111111111111111",
email,
"UKR",
&ip,
"Premium package",
"777",
"WEB",
)
chargeResponse, err := solidGateClient.Charge(context.Background(), chargeRequest)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", chargeResponse)
```
Recurring transaction
``` go
ip := net.ParseIP("8.8.8.8")
email, _ := mail.ParseAddress("jondou@gmail.com")
recurringRequest := solidgate.NewRecurringRequest(
1050,
"USD",
"7ats8da7sd8-a66dfa7-a9s9das89t",
email,
&ip,
"Premium package",
"777",
"WEB",
)
recurringResponse, err := solidGateClient.Recurring(context.Background(), recurringRequest)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", recurringResponse)
```
Refund transaction
``` go
refundRequest := solidgate.NewRefundRequest("777", 1050)
refundResponse, err := solidGateClient.Refund(context.Background(), refundRequest)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", refundResponse)
```
## Source(s)
* [SolidGate](https://solid.ng/)
* [SolidGate Documentation](https://solidgate.atlassian.net/wiki/spaces/API/pages/4718593/EN)
[license-link]: https://github.com/zhooravell/go-solidgate/blob/master/LICENSE
[license-image]: https://img.shields.io/dub/l/vibe-d.svg
[travis-link]: https://travis-ci.com/zhooravell/go-solidgate
[travis-image]: https://travis-ci.com/zhooravell/go-solidgate.svg?branch=master
[codecov-link]: https://codecov.io/gh/zhooravell/go-solidgate
[codecov-image]: https://codecov.io/gh/zhooravell/go-solidgate/branch/master/graph/badge.svg
[scrutinizer-link]: https://scrutinizer-ci.com/g/zhooravell/go-solidgate/?branch=master
[scrutinizer-image]: https://scrutinizer-ci.com/g/zhooravell/go-solidgate/badges/quality-score.png?b=master