Braintree v0.7.0 Braintree.HTTP

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 id
  • private_key - Braintree private key
  • public_key - Braintree public key

All three must have values set or a Braintree.ConfigError will be raised at runtime. All those config values support the {:system, "VAR_NAME"} as a value - in that case the value will be read from the system environment with System.get_env("VAR_NAME").

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

Functions

delete(path, payload \\ %{})
get(path, payload \\ %{})
post(path, payload \\ %{})
put(path, payload \\ %{})
request(method, path, body \\ "")

Specs

request(atom, binary, binary | Map.t) ::
  {:ok, Map.t} |
  {:error, Map.t} |
  {:error, integer} |
  {:error, binary}

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

defmodule MyApp.Disbursement do
  alias Braintree.HTTP

  def disburse(params \ %{}) do
    HTTP.request(:get, "disbursements", params)
  end
end