Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 965 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 965 Bytes

Fortifi go-api

Usage

Import api with your required client & models

import (
	api "github.com/fortifi/go-api"
	"github.com/fortifi/go-api/client/customers"
)

New Fortifi api instance with your service account credentials

	fortifi, err := api.NewInstance(
		"my-org-fid",
		"my-service-account-user",
		"my-service-account-key")

Use Fortifi

	// Example: Retrieve customer by external reference
	cid := "my-customer-external-reference"

	params := customers.NewGetCustomersFindByReferenceParams()
	params.SetReference(&cid)

	instance, err := fortifi.GetAPIInstance()
	if err != nil {
		panic(fmt.Sprintf("API instance not available %s\n", err.Error()))
	}

	response, err := instance.Customers.GetCustomersFindByReference(params, fortifi.GetAuthenticator())
	if err != nil {
		panic(fmt.Sprintf("failed to retrieve customer because %s\n", err.Error()))
	}

	fmt.Printf("Customers First Name is %s\n", response.Payload.FirstName)