Skip to main content


The Talon.One Go SDK can be found on GitHub.

Quick start

Install via Go get:

go get -u

Use the Update customer session endpoint:

package mainimport ("context""encoding/json""fmt"talon "")
func main() {configuration := talon.NewConfiguration()// Set API base pathconfiguration.Servers = talon.ServerConfigurations{  {    // Notice that there is no trailing '/'    URL:         "",    Description: "Talon.One's API base URL",  },}integrationClient := talon.NewAPIClient(configuration)// Create integration authentication context using api keyintegrationAuthContext := context.WithValue(  context.Background(),  talon.ContextAPIKeys,  map[string]talon.APIKey{    "Authorization": talon.APIKey{      Prefix: "ApiKey-v1",      Key:    "fd1fd219b1e953a6b2700e8034de5bfc877462ae106127311ddd710978654312",    },  },)// Instantiating a NewCustomerSessionV2 structcustomerSession := talon.NewCustomerSession{  // You can use both struct literals  ProfileId:   talon.PtrString("DEADBEEF"),  CouponCodes: &[]string{"Cool-Stuff!"},}// Or alternatively, using the relevant setter in a later stage in the codenewCustomerSession.SetCartItems([]talon.CartItem{  talon.CartItem{    Name:     "Pad Thai - Veggie",    Sku:      "pad-332",    Quantity: 1,    Price:    5.5,    Category: talon.PtrString("Noodles"),  },  talon.CartItem{    Name:     "Chang",    Sku:      "chang-br-42",    Quantity: 1,    Price:    2.3,    Category: talon.PtrString("Beverages"),  },})// Instantiating a new IntegrationRequestintegrationRequest := talon.IntegrationRequest{  CustomerSession: newCustomerSession,}// Optional list of requested information to be present on the response.// Consult the Integration API docs for a full list of supported values// integrationRequest.SetResponseContent([]string{//   "customerSession",//   "customerProfile",//   "loyalty",// })// Create/Update customer session using `UpdateCustomerSessionV2` functionintegrationState, _, err := integrationClient.IntegrationApi.  UpdateCustomerSessionV2(integrationAuthContext, "deetdoot_2").  Body(integrationRequest).  Execute()if err != nil {  fmt.Printf("ERROR while calling UpdateCustomerSessionV2: %s\n", err)  return}fmt.Printf("%#v\n", integrationState)}

For more information, see Go SDK.