BitPay.WebClient
Convenience methods for the BitPay REST API.
Summary
The module struct contains two fields:
Sends a post request to the server that creates a new invoice
Generic Get method to the WebClient endpoint + path Input:
- the path (string)
- params for the request (as map)
- WebClient struct
Retrieves an invoice from the BitPay server
initiates a ‘client side’ pairing
creates a token on the server corresponding to the WebClients public and private keys
Generic post method to the WebClient endpoint + path Input:
- the path (string)
- params for the request (as map)
- WebClient struct
Functions
Specs
__struct__ :: %BitPay.WebClient{pem: term, uri: term}
The module struct contains two fields:
- uri: the api uri, which defaults to https://bitpay.com
- pem: a pem file containing the public and private keys, which can be generated from the BitPay.KeyUtils module.
Sends a post request to the server that creates a new invoice.
Input:
- a params map that must contain a price and a currency
- a WebClient struct. The web client struct must be paired with BitPay.
Response: A map corresponding to the data section of the JSON response from the server.
Generic Get method to the WebClient endpoint + path Input:
- the path (string)
- params for the request (as map)
WebClient struct
Response: a map containing the response code, successe status as true or false, and the body of the http response
Retrieves an invoice from the BitPay server.
Input:
- an invoice id
- a WebClient
Response: a map corresponding to the data section of the JSON response from the server.
initiates a ‘client side’ pairing.
Input: a WebClient
Response: {:ok, <pairingCode> }
The pairingCode can then be used at /dashboard/merchant/api-tokens to authenticate the token
creates a token on the server corresponding to the WebClients public and private keys
Input:
- a pairing code from the server
- a WebClient
Response: a key/value pair such as %{pos: 92hgkeit92392gjgj}