Skip to content

tooolbox/fiserv

 
 

Repository files navigation

Fiserv Go SDK

Go Reference

Fiserv RESTful Web Services

Payment Gateway API Specification.

  • API version: 6.14.0.20201015.001

Usage

With Go Modules:

package main

import (
    "fmt"
    "github.com/tooolbox/fiserv"
)

func main() {
    creds := fiserv.Credentials{
        ApiKey:    "...",
        ApiSecret: "...",
    }

    clnt, err := fiserv.NewClientWithResponses(fiserv.SandboxServer, creds)
    if err != nil {
        panic(err)
    }

    // Calls will automatically generate the authentication signature.
    resp, err := clnt.SubmitPrimaryTransactionWithResponse(
        context.Background(),
        &fiserv.SubmitPrimaryTransactionParams{
            // Params will be automatically populated
            // with signature-related headers.
        },
        &fiserv.SubmitPrimaryTransactionJSONBody{
            // ...
        },
    )
    if err != nil {
        panic(err)
    }

    fmt.Println(resp.JSON200.ApprovedAmount.Total)
}

Developing

To re-generate the OpenAPI types and client:

> cd tools
> go generate # install the tools
> cd ..
> go generate # generate the code

Reference Documentation

https://docs.firstdata.com/org/gateway/docs/api