The BepaidEx Elixir library provides convenient access to the bePaid API from applications written in the Elixir language.
Add bepaid_ex
to your list of dependencies in mix.exs
:
def deps do
[
{:bepaid_ex, "~> 0.9.0"}
]
end
Update your dependencies:
$ mix deps.get
BepaidEx requires certain properties to be configured.
In order to load ENV vars at runtime, use {:system, ENV_VAR_NAME}
notation.
Please note ENV vars have to be set prior app loading: export BEPAID_SHOP_ID=123
...
config :bepaid_ex,
shop_id: {:system, "BEPAID_SHOP_ID"},
key_secret: {:system, "BEPAID_KEY_SECRET"}
Otherwise you can set constant values via binaries:
config :bepaid_ex,
shop_id: "BEPAID_SHOP_ID_HERE",
key_secret: "BEPAID_KEY_SECRET_HERE"
alias Bepaid.{Gateway, Payment}
%Payment{amount: 100, description: "Test payment", test: true}
|> Payment.set_tracking_id()
|> Payment.update_customer(%{ip: "127.0.0.1"})
|> Payment.update_credit_card(%{token: "TOKEN"})
|> Bepaid.put_charge()
Parameterize is released under MIT license.