Braintree.HTTP (Braintree v0.13.0)
Base client for all server interaction, used by all endpoint specific modules.
This request wrapper coordinates the remote server, headers, authorization and SSL options.
Using Braintree.HTTP
requires the presence of three config values:
merchant_id
- Braintree merchant idprivate_key
- Braintree private keypublic_key
- Braintree public key
All three values must be set or a Braintree.ConfigError
will be raised at
runtime. All those config values support the {:system, "VAR_NAME"}
as a
value - in which case the value will be read from the system environment with
System.get_env("VAR_NAME")
.
Link to this section Summary
Functions
Centralized request handling function. All convenience structs use this function to interact with the Braintree servers. This function can be used directly to supplement missing functionality.
Link to this section Types
response()
@type response() :: {:ok, map()} | {:error, atom()} | {:error, Braintree.ErrorResponse.t()} | {:error, binary()}
Link to this section Functions
delete(path)
delete(path, payload)
delete(path, payload, opts)
get(path)
get(path, payload)
get(path, payload, opts)
post(path)
post(path, payload)
post(path, payload, opts)
put(path)
put(path, payload)
put(path, payload, opts)
request(method, path, body \\ %{}, opts \\ [])
Centralized request handling function. All convenience structs use this function to interact with the Braintree servers. This function can be used directly to supplement missing functionality.
example
Example
defmodule MyApp.Disbursement do
alias Braintree.HTTP
def disburse(params \ %{}) do
HTTP.request(:get, "disbursements", params)
end
end