BitPay.WebClient
Convenience methods for the BitPay REST API.
Summary↑
__struct__() | The module struct contains two fields: |
create_invoice(params, webclient) | Sends a post request to the server that creates a new invoice |
get(path, webclient) | Generic Get method to the WebClient endpoint + path Input:
|
get_invoice(id, webclient) | Retrieves an invoice from the BitPay server |
get_pairing_code(client) | initiates a ‘client side’ pairing |
pair_pos_client(code, client) | creates a token on the server corresponding to the WebClients public and private keys |
post(path, params, webclient) | Generic post method to the WebClient endpoint + path Input:
|
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}
Generic post 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