Omise Elixir Client
Omise for Elixir
Installation
-
Add omise to your list of dependencies in
mix.exs:
def deps do
[{:omise, "~> 0.4"}]
end- Ensure omise is started before your application:
def application do
[applications: [:omise]]
endConfiguration
Set the following configuration variables in config/config.exs file:
config :omise,
public_key: "OMISE_PUBLIC_KEY",
secret_key: "OMISE_SECRET_KEY"Or manually configure at runtime:
Omise.configure(public_key: "OMISE_PUBLIC_KEY", secret_key: "OMISE_SECRET_KEY")Example
response = Omise.Charge.create(
amount: 1000_00,
currency: "thb",
card: "tokn_51w6fvilnsxalda4cih"
)
case response do
{:ok, charge} ->
# handle success
{:error, error} ->
# handle failure
endDevelopment
-
Install all dependencies with
mix deps.get -
Run tests with
mix test