ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - WTTJ/chargebeex: An Elixir library to interact with Chargebee
An Elixir library to interact with Chargebee. Contribute to WTTJ/chargebeex development by creating an account on GitHub.
Visit Site

GitHub - WTTJ/chargebeex: An Elixir library to interact with Chargebee

GitHub - WTTJ/chargebeex: An Elixir library to interact with Chargebee

Chargebeex

Chargebeex is an Elixir implementation of Chargebee API.

This is a heavily inspired fork of the original work by Nicolas Marlier

Project status

Chargebeex is used for several months in production at Welcome to the Jungle.

Installation

The package can be installed by adding chargebeex to your list of dependencies in mix.exs:

# mix.exs
def deps do
  [
    {:chargebeex, "~> 0.4.0"}
  ]
end

Configuration

Chargebeex can be configured using Config or environment variables.

Config

config :chargebeex,
  namespace: "my-namespace",
  api_key: "my-api-key"

Environment variables

export CHARGEBEEX_API_KEY=my-api-key
export CHARGEBEEX_NAMESPACE=my-namespace

Usage

{:ok, %Chargebeex.Customer{}} = Chargebeex.Customer.retrieve("foobar")
{:ok, [%Chargebeex.Customer{}], [%Chargebeex.Customer{}]} = Chargebeex.Customer.list()
{:ok, %Chargebeex.Customer{}} = Chargebeex.Customer.update("foobar", %{name: "updated"})
{:ok, %Chargebeex.Customer{}} = Chargebeex.Customer.delete("foobar")

Custom Fields

Chargebee provides a way to add user-specific fields for resources like Customer, Subscriptions, ... called Custom Fields.

These fields are prepended with the cf_ prefix. These fields can be accessed in the special custom_fields field of the structure. Please note Custom Fields are only available for Customers, Subscriptions, Product Families, Plans, Addons and Price Points.

Example:

 iex> Chargebeex.Customer.retrieve("barbaz")
 {:ok, %Chargebeex.Customer{
     id: "barbaz",
     allow_direct_debit: false,
     custom_fields: %{
       "cf_my_custom_field" => "foobar"
     },
     [...]}
  }

Extra Resources

Some ressources can have extra infos returned along them. For example, when querying a Customer, if any card or subscription is linked to this customer, these resources will also be returned. For internal API simplification, these fields can be accessed in the resources field of the structure.

Example:

 iex> Chargebeex.Customer.retrieve("barbaz")
 {:ok, %Chargebeex.Customer{
     id: "barbaz",
     allow_direct_debit: false,
      resources: %{
        "card" => %Chargebeex.Card{
          billing_addr1: "my_address",
          billing_addr2: nil,
          billing_city: "Paris",
          ...
          }
      }
     [...]}
  }

Run tests

mix test

License

MIT

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory