Documentation ¶
Overview ¶
The client package provides convenience methods for authenticating with Bitpay and creating basic invoices.
Index ¶
- type Client
- func (client *Client) CreateInvoice(price float64, currency string) (inv invoice, err error)
- func (client *Client) GetInvoice(invId string) (inv invoice, err error)
- func (client *Client) GetToken(facade string) (token string, err error)
- func (client *Client) GetTokens() (tokes []map[string]string, err error)
- func (client *Client) PairClient(paylo map[string]string) (tok Token, err error)
- func (client *Client) PairWithCode(str string) (tok Token, err error)
- func (client *Client) PairWithFacade(str string) (tok Token, err error)
- func (client *Client) Post(path string, paylo map[string]string) (response *http.Response, err error)
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
The Client struct maintains the state of the current client. To use a client from session to session, the Pem and Token will need to be saved and used in the next client. The ClientId can be recreated by using the key_util.GenerateSinFromPem func, and the ApiUri will generally be https://bitpay.com. Insecure should generally be set to false or not set at all, there are a limited number of test scenarios in which it must be set to true.
func (*Client) CreateInvoice ¶
CreateInvoice returns an invoice type or pass the error from the server. The method will create an invoice on the BitPay server.
func (*Client) GetInvoice ¶
GetInvoice is a public facade method, any client which has the ApiUri field set can retrieve an invoice from that endpoint, provided they have the invoice id.
func (*Client) PairClient ¶
func (*Client) PairWithCode ¶
PairWithCode retrieves a token from the server and authenticates the keys of the calling client. The string passed to the client is a "pairing code" that must be retrieved from https://bitpay.com/dashboard/merchant/api-tokens. PairWithCode returns a Token type that must be assigned to the Token field of a client in order for that client to create invoices. For example `client.Token = client.PairWithCode("abcdefg")`.
func (*Client) PairWithFacade ¶
PairWithFacade