github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/products/GetPaymentProductExample.go (about) 1 // This file was auto-generated from the API references found at 2 // https://epayments-api.developer-ingenico.com/ 3 4 package examples 5 6 import ( 7 "fmt" 8 9 "github.com/Ingenico-ePayments/connect-sdk-go/merchant/products" 10 ) 11 12 func getPaymentProductExample() { 13 client, clientErr := getClient() 14 if clientErr != nil { 15 panic(clientErr) 16 } 17 defer client.Close() 18 19 // Assigning literals to pointer variables directly is not supported. 20 // The below code uses helper functions newBool, newInt64 and newString to overcome this issue. 21 // http://stackoverflow.com/a/30716481 lists a few more alternatives. 22 // The code for these helper functions can be found in file Helper.go 23 24 var query products.GetParams 25 query.CountryCode = newString("US") 26 query.CurrencyCode = newString("USD") 27 query.Locale = newString("en_US") 28 query.Amount = newInt64(1000) 29 query.IsRecurring = newBool(true) 30 query.IsInstallments = newBool(true) 31 query.ForceBasicFlow = newBool(false) 32 query.AddHide("fields") 33 34 response, err := client.Merchant("merchantId").Products().Get(1, query, nil) 35 36 fmt.Println(response, err) 37 }