Open sfro opened 5 years ago
@sfro Hi , You can initialise the environment struct to define an arbitrary url and port number in the following way :
env := chargebee.Environment{
Key: "api-key",
SiteName: "site-name",
ChargebeeDomain: "arbitrary-url.in:8080",
Protocol: "http",
}
And you can pass the above env along with your request as below :
res,err := subscriptionAction.Retrieve("__test__5SK0bLNFRFuFEQ3d7").RequestWithEnv(env)
if err != nil {
fmt.Println(err)
}else{
Subscription := res.Subscription
fmt.Println(Subscription.Id)
}
Yeah, I ended up doing something like that, it just feels a little hacky to have to declare an url with a "." in it and have the port number in the Chargebee domain field. It works, I just don't like it very much 😄 so for localhost it would look like below:
env := chargebee.Environment{
Key: "api-key",
SiteName: "127.0",
ChargebeeDomain: "0.1:8080",
Protocol: "http",
}
Hi!
I would like to be able to use this client to make requests to an URL that does not follow the convention defined here: https://github.com/chargebee/chargebee-go/blob/master/environment.go#L39
I would like to be able to define an arbitrary url as well as a port number for test purposes. Would it be possible to do something like this instead?