ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - altyaper/conekta-elixir: Elixir library for Conekta api calls
Elixir library for Conekta api calls. Contribute to altyaper/conekta-elixir development by creating an account on GitHub.
Visit Site

GitHub - altyaper/conekta-elixir: Elixir library for Conekta api calls

GitHub - altyaper/conekta-elixir: Elixir library for Conekta api calls

Build Status

Conekta Library

Wrapper to connect with https://api.conekta.io.

conekta-elixir documentation

Setup

Installation

Add Conekta to your mix.exs dependencies:

#mix.exs
defp deps do
  [
    #If you have trouble with poison add
    #{:poison, "~> 3.1", override: true}
    {:conekta, "~> 1.0"}
  ]
end

Configuration

Add your keys in your config.exs file

# config.exs
config :conekta,
  publickey: "YOUR-PUBLIC-KEY",
  privatekey: "YOUR-PRIVATE-KEY"

Customers

Get

Get all current customers

#Get the last
Conekta.Customers.customers()

Create

Create a customer by passing a %Conekta.Customer{} struct

#Create a new customer map
new_customer = %Customer{
  name: "Fake Name",
  email: "[email protected]",
  corporate: true,
  payment_sources: [%{
      token_id: "tok_test_visa_4242",
      type: "card"
  }]
}

#Create a new customer
Conekta.Customers.create(new_customer)

Find

Find a customer by passing the unique ID

Conekta.Customers.find(id)

Delete

Delete a customer by passing the unique ID

Conekta.Customers.delete(id)

Orders

Get

Conekta.Orders.orders()

Create

#Create a new order map
new_order = %Order{currency: "MXN",
customer_info: %{
    customer_id: content.id
}, line_items: [%{
    name: "Product 1",
    unit_price: 35000,
    quantity: 1
}], charges: [%{
    payment_method: %{
        type: "default"
    }
}]}

#Create an order
response = Conekta.Orders.create(new_order)

WebHooks

Helper function for webhook handling. check possible events

case Conekta.WebHook.received(params) do
  {:charge_created, struct} -> ...
  {:charge_paid, struct} -> ...
  {:plan_created, struct} -> ...
  {:customer_created, struct} -> ...
  {:subscription_created, struct} -> ...
  {:subscription_paid, struct} -> ...
  {:subscription_canceled, struct} -> ...
  {:chargeback_created, struct} -> ...
  {:chargeback_lost, struct} -> ...
end

Test

If you want to add something new, make sure all the tests pass before making a PR

mix test

Send pull request

I would love to check new contributions to this repository. Fork from dev and do a PR into dev again.

License

Available with MIT License.

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