OpenNodex v0.3.0 OpenNodex View Source
Documentation for OpenNodex.
Link to this section Summary
Functions
Get a specific charge
Get charges
Retrieve the available currencies
Retrieve the exchange rates
Link to this section Functions
Link to this function
create_charge(client, amount, base_currency, callback_url, success_url) View Source
Create a charge.
Examples
iex> callback_url = "https://example.com/callback"
iex> success_url = "https://example.com/success"
iex> OpenNodex.Client.new("api_key")
...> |> OpenNodex.create_charge(99.01, "USD", callback_url, success_url)
{:ok, %OpenNodex.Charge{callback_url: nil, name: nil, notif_email: nil, amount: 2573293, auto_settle: false, chain_invoice: %OpenNodex.Charge.ChainInvoice{address: "3btcaddress", settled_at: nil}, created_at: 1546732008, currency: "USD", description: "N/A", fiat_value: 99, id: "abbacadabba-d123-456a-baba-99bfdcfb16a1", lightning_invoice: %OpenNodex.Charge.LightningInvoice{created_at: 1546732009, expires_at: 1546735609, payreq: "lnbcsomelonginvoicestring", settled_at: nil}, notes: "", order_id: "N/A", source_fiat_value: 99, status: "unpaid", success_url: "https://site.com/order/abc123"}}
Link to this function
get_charge(client, id) View Source
Get a specific charge.
Examples
iex> OpenNodex.Client.new("api_key")
...> |> OpenNodex.get_charge("abbacadabba-d123-456a-baba-99bfdcfb16a1")
{:ok, %OpenNodex.Charge{callback_url: nil, name: nil, notif_email: nil, amount: 2573293, auto_settle: false, chain_invoice: %OpenNodex.Charge.ChainInvoice{address: "3btcaddress", settled_at: nil}, created_at: 1546732008, currency: "USD", description: "N/A", fiat_value: 99, id: "abbacadabba-d123-456a-baba-99bfdcfb16a1", lightning_invoice: %OpenNodex.Charge.LightningInvoice{created_at: 1546732009, expires_at: 1546735609, payreq: "lnbcsomelonginvoicestring", settled_at: nil}, notes: "", order_id: "N/A", source_fiat_value: 99, status: "unpaid", success_url: "https://site.com/order/abc123"}}
Link to this function
get_charges(client) View Source
Get charges.
Examples
iex> OpenNodex.Client.new("api_key")
...> |> OpenNodex.get_charges()
{:ok, [%OpenNodex.Charge{callback_url: nil, name: nil, notif_email: nil, amount: 2573293, auto_settle: false, chain_invoice: %OpenNodex.Charge.ChainInvoice{address: "3btcaddress", settled_at: nil}, created_at: 1546732008, currency: "USD", description: "N/A", fiat_value: 99, id: "abbacadabba-d123-456a-baba-99bfdcfb16a1", lightning_invoice: %OpenNodex.Charge.LightningInvoice{created_at: 1546732009, expires_at: 1546735609, payreq: "lnbcsomelonginvoicestring", settled_at: nil}, notes: "", order_id: "N/A", source_fiat_value: 99, status: "unpaid", success_url: "https://site.com/order/abc123"}]}
Link to this function
get_currencies(client) View Source
Retrieve the available currencies.
Examples
iex> OpenNodex.Client.new("api_key")
...> |> OpenNodex.get_currencies()
{:ok, ["USD", "EUR", "RUB", "HKD", "CAD"]}
Link to this function
get_rates(client) View Source
Retrieve the exchange rates.
Examples
iex> OpenNodex.Client.new("api_key")
...> |> OpenNodex.get_rates()
{:ok, %{"BTCUSD" => %{"USD" => 3845.30}, "BTCEUR" => %{"EUR" => 2890.95}}}