GO SDK provides API options for integrating Solidgate’s payment orchestrator into your GO applications.
Check our
- Payment guide to understand business value better
- API Reference to find more examples of usage
SDK for GO contains | Table of contents |
---|---|
api.go/solidgate/ – main file for API integrationencryption.go – library for encryption-related operationsentries.go – contains form-related methods (e.g., form resign)go.mod – dependency file for managing module imports
|
Requirements Installation Usage Errors |
- GO: 1.13 or later
- Solidgate account: Public and secret key (request via sales@solidgate.com)
To install the GO SDK:
- Ensure you have your public and secret key.
- Run:
go get github.com/solidgate-tech/go-sdk
- Import the library into your Go application:
import solidgate "github.com/solidgate-tech/go-sdk"
- Use test credentials to validate your integration before deploying to production.
Returns a raw JSON response.
package main
import (
"encoding/json"
"fmt"
solidgate "github.com/solidgate-tech/go-sdk"
)
func main() {
//.....
someRequestStruct := SomeRequestStruct{}
someStructJson, err := json.Marshal(someRequestStruct)
if err != nil {
fmt.Print(err)
}
solidgateSdk := solidgate.NewSolidGateApi("YourPublicKey", "YourSecretKey")
response, err := solidgateSdk.Charge(someStructJson)
if err != nil {
fmt.Print(err)
}
someResponeStruct = SomeResponeStruct{}
err := json.Unmarshal(response, &someResponeStruct)
if err != nil {
fmt.Print(err)
}
//.....
}
Returns a FormInitDTO
struct in JSON.
package main
import (
"encoding/json"
"fmt"
solidgate "github.com/solidgate-tech/go-sdk"
)
func main() {
solidgateSdk := solidgate.NewSolidGateApi("YourPublicKey", "YourSecretKey")
someRequestStruct := SomeRequestStruct{}
someStructJson, err := json.Marshal(someRequestStruct)
if err != nil {
fmt.Print(err)
}
formInitDto, err := solidgateSdk.FormMerchantData(someStructJson)
if err != nil {
fmt.Print(err)
}
// ...
}
Returns a FormUpdateDTO
struct in JSON.
package main
import (
"encoding/json"
"fmt"
solidgate "github.com/solidgate-tech/go-sdk"
)
type UpdateParams struct {
...
}
func main() {
solidgateSdk := solidgate.NewSolidGateApi("YourPublicKey", "YourSecretKey")
someRequestStruct := UpdateParams{}
someStructJson, err := json.Marshal(someRequestStruct)
if err != nil {
fmt.Print(err)
}
formUpdateDto, err := solidgateSdk.FormUpdate(someStructJson)
if err != nil {
fmt.Print(err)
}
// ...
}
Returns a FormResignDTO
struct in JSON.
package main
import (
"encoding/json"
"fmt"
solidgate "github.com/solidgate-tech/go-sdk"
)
func main() {
solidgateSdk := solidgate.NewSolidGateApi("YourPublicKey", "YourSecretKey")
someRequestStruct := SomeRequestStruct{}
someStructJson, err := json.Marshal(someRequestStruct)
if err != nil {
fmt.Print(err)
}
formResignDto, err := solidgateSdk.FormResign(someStructJson)
if err != nil {
fmt.Print(err)
}
// ...
}
Handle errors.
if err != nil {
fmt.Println(err)
}