paveltyk / bepaid_ex

The Elixir library for bePaid API

Home Page:https://hex.pm/packages/bepaid_ex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BepaidEx - Elixir Library for bePaid payment processing gateway

CircleCI Hex.pm Hex.pm

The BepaidEx Elixir library provides convenient access to the bePaid API from applications written in the Elixir language.

Installation

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

Configuration

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"

Usage example:

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()

Links

License

Parameterize is released under MIT license.

About

The Elixir library for bePaid API

https://hex.pm/packages/bepaid_ex

License:MIT License


Languages

Language:Elixir 100.0%