Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate is used for obtaining a JWT token. JWT is required only for payout request API call
func HTTPSend ¶
func HTTPSend(p *SendParams) error
HTTPSend sends to endpoint with an optional request body and get the HTTP response result in into
func Status ¶
Status returns current state of the API. "OK" is returned if everything is fine, otherwise an error message is returned.
func UseBaseURL ¶
func UseBaseURL(b BaseURL)
UseBaseURL sets the base URL to use to connect to NOWPayment's API
Types ¶
type BaseURL ¶
type BaseURL string
BaseURL is the URL to NOWPayment's service
const ( ProductionBaseURL BaseURL = "https://api.nowpayments.io/v1" SandBoxBaseURL = "https://api-sandbox.nowpayments.io/v1" )
type HTTPClient ¶
type HTTPClient interface { // Do executes the HTTP request to the API server. Do(*http.Request) (*http.Response, error) }
HTTPClient defines methods of an HTTP client.
type SendParams ¶
type SendParams struct { Body io.Reader Into interface{} Path string RouteName string Values url.Values JWTToken string }
SendParams are parameters needed to build and send an HTTP request to the service
type V2ResponseFormat ¶ added in v1.0.1
type V2ResponseFormat[T interface{}] struct {
Result T `json:"result"`
}
V2ResponseFormat handle some inconsistency on their side some response are at root level, sometimes in data (list only) and sometimes under result key because of many result format, we use generics to instantiate the struct with the correct response format