Giter Site home page Giter Site logo

ramka001 / gringotts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aviabird/gringotts

0.0 2.0 0.0 699 KB

A complete payment library for Elixir and Phoenix Framework

Home Page: https://hexdocs.pm/gringotts/Gringotts.html

License: MIT License

Elixir 96.26% HTML 3.74%

gringotts's Introduction

Gringotts Logo

Gringotts is a payment processing library in Elixir integrating various payment gateways, this draws motivation for shopify's activemerchant gem. Checkout the Demo here.

Build Status Coverage Status Docs coverage Help Contribute to Open Source

A simple and unified API to access dozens of different payment gateways with very different internal APIs is what Gringotts has to offer you.

Installation

From hex.pm

Make the following changes to the mix.exs file.

Add gringotts to the list of dependencies.

def deps do
  [
    {:gringotts, "~> 1.0"},
    # ex_money provides an excellent Money library, and integrates
    # out-of-the-box with Gringotts
    {:ex_money, "~> 1.1.0"}
  ]
end

Add gringotts to the list of applications to be started.

def application do
  [
    extra_applications: [:gringotts]
  ]
end

Usage

This simple example demonstrates how a purchase can be made using a person's credit card details.

Add configs in config/config.exs file.

config :gringotts, Gringotts.Gateways.Monei,
    adapter: Gringotts.Gateways.Monei,
    userId: "your_secret_user_id",
    password: "your_secret_password",
    entityId: "your_secret_channel_id"

Copy and paste this code in your module

alias Gringotts.Gateways.Monei
alias Gringotts.{CreditCard}

card = %CreditCard{
  first_name: "Harry",
  last_name: "Potter",
  number: "4200000000000000",
  year: 2099, month: 12,
  verification_code:  "123",
  brand: "VISA"
}

amount = Money.new(42, :USD)

case Gringotts.purchase(Monei, amount, card, opts) do
  {:ok,    %{id: id}} ->
    IO.puts("Payment authorized, reference token: '#{id}'")

  {:error, %{status_code: error, raw: raw_response}} ->
    IO.puts("Error: #{error}\nRaw:\n#{raw_response}")
end

Supported Gateways

Gateway Supported countries
Authorize.Net AD, AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GB, GI, GR, HU, IE, IT, LI, LU, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, US, VA
CAMS AU, US
MONEI DE, EE, ES, FR, IT, US
PAYMILL AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA
Stripe AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IN, IT, LU, NL, NO, SE, SG, US
TREXLE AD, AE, AT, AU, BD, BE, BG, BN, CA, CH, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GI, GR, HK, HU, ID, IE, IL, IM, IN, IS, IT, JO, KW, LB, LI, LK, LT, LU, LV, MC, MT, MU, MV, MX, MY, NL, NO, NZ, OM, PH, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, TT, UM, US, VA, VN, ZA
Wirecard AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GI, GR, HU, IE, IL, IM, IS, IT, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, VA

Road Map

  • Support more gateways on an on-going basis.
  • Each gateway request is hosted in a worker process and supervised.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.