All Projects → swelham → cashier

swelham / cashier

Licence: MIT license
Cashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to cashier

PayPalPlugin
Official integration with PayPal Commerce Platform
Stars: ✭ 21 (-51.16%)
Mutual labels:  paypal, payment, payment-gateway
Gringotts
A complete payment library for Elixir and Phoenix Framework
Stars: ✭ 396 (+820.93%)
Mutual labels:  payment, gateway, payment-gateway
toss
Toss 결제를 위한 python client library
Stars: ✭ 51 (+18.6%)
Mutual labels:  payment, payment-gateway
adyen-node-api-library
Adyen API Library for Node.js
Stars: ✭ 82 (+90.7%)
Mutual labels:  payment, payment-gateway
cybersource-sdk-java
Java SDK for CyberSource Simple Order API
Stars: ✭ 44 (+2.33%)
Mutual labels:  payment, payment-gateway
42-cent
Node.js multi-gateway payment processing module
Stars: ✭ 43 (+0%)
Mutual labels:  payment, payment-gateway
wc-moldovaagroindbank
WooCommerce maib Moldova Agroindbank Payment Gateway
Stars: ✭ 13 (-69.77%)
Mutual labels:  payment, payment-gateway
Paynow-NodeJS-SDK
NodeJS SDK for Zimbabwe's leading payments gateway, Paynow
Stars: ✭ 23 (-46.51%)
Mutual labels:  payment, payment-gateway
adyen-hybris
Adyen Payment plugin for Hybris
Stars: ✭ 23 (-46.51%)
Mutual labels:  payment, payment-gateway
omnipay-2checkout
2Checkout driver for the Omnipay PHP payment processing library
Stars: ✭ 25 (-41.86%)
Mutual labels:  payment, payment-gateway
python-daraja
Python Wrapper for interacting with the MPESA Daraja API. More Features to be implemented
Stars: ✭ 20 (-53.49%)
Mutual labels:  payment, payment-gateway
omise-magento
Omise Magento Plugin
Stars: ✭ 32 (-25.58%)
Mutual labels:  payment, gateway
Banklink
PHP payment library to easily integrate Baltic banklinks (supports old and new iPizza protocol), E-commerce gateaway (Estcard, Nets Estonia), Liisi Payment Link and Pocopay.
Stars: ✭ 34 (-20.93%)
Mutual labels:  payment, gateway
midtrans-nodejs-client
Official Midtrans Payment API Client for Node JS | https://midtrans.com
Stars: ✭ 124 (+188.37%)
Mutual labels:  payment, payment-gateway
ccashcow
💰 Accept cards & crypto. Payments so easy a cow could do it.
Stars: ✭ 40 (-6.98%)
Mutual labels:  payment, payment-gateway
react-native-payumoney
React Native Payumoney (Android/IOS)
Stars: ✭ 18 (-58.14%)
Mutual labels:  payment, payment-gateway
sep-pay
Pay.ir Payment Package for Laravel 5.3+
Stars: ✭ 17 (-60.47%)
Mutual labels:  payment, payment-gateway
Payum
PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro
Stars: ✭ 1,665 (+3772.09%)
Mutual labels:  paypal, payment
Test Payment Cards
Cheatsheet of test payment cards for various payment gateways
Stars: ✭ 217 (+404.65%)
Mutual labels:  paypal, payment-gateway
laravel-pix
Uma solucão simples para integrar sua aplicação Laravel a API PIX do Banco Central do Brasil
Stars: ✭ 73 (+69.77%)
Mutual labels:  payment, payment-gateway

Cashier

Build Status Deps Status Hex Version Join the chat at https://gitter.im/swelham/cashier Open Source Helpers

Cashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP

Usage

The following are basic usage examples on how to use cashier in it's current state. This library is being activily developed and is likely to change as we move towards the first release.

Setup

Add cashier as a dependency

defp deps do
  {:cashier, "~> 0.2.0"}
end

Make sure the cashier application gets started

def application do
  [applications: [:cashier]]
end

Config options

use Mix.Config

# cashier options
config :cashier, :cashier,
  defaults: [
    currency: "USD",
    gateway: :paypal,
    timeout: 20_000 # this option is the OTP timeout setting
  ],
  # this option is passed directly into HTTPoison and can contain any
  # of the valid options listed here - https://hexdocs.pm/httpoison/HTTPoison.html#request/5
  http: [
    recv_timeout: 20_000
  ]

# PayPal specific config
config :cashier, :paypal,
  # Please note the PayPal gateway currently only supports the /v1 endpoint
  # and this is automattically added for you
  url: "https://api.sandbox.paypal.com",
  client_id: "<paypal_client_id>",
  client_secret: "<paypal_client_secret>"

Cashier request examples

alias Cashier.Address
alias Cashier.PaymentCard

address = %Address{
    line1: "123",
    line2: "Main",
    city: "New York",
    state: "New York",
    country_code: "US",
    postal_code: "10004"
}

card = %PaymentCard{
    holder: {"John", "Smith"},
    brand: "visa",
    number: "4032030901103714",
    expiry: {11, 2021},
    cvv: "123"
}

# Note: The result return type for each request is currently the decoded
#       data returned from the payment provider, this will change in the future.

# Purchase request
# the card parameter can be either a %PaymentCard or stored card id 
case Cashier.purchase(9.99, card, [billing_address: address]) do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

# Authorize request
# the card parameter can be either a %PaymentCard or stored card id 
case Cashier.authorize(9.99, card, [billing_address: address]) do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

# Capture request
case Cashier.capture("<capture_id>", 19.45, [final_capture: true]) do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

#Void request
case Cashier.void("<void_id>") do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

#Refund request
case Cashier.refund("<refund_id>", [amount: 9.99]) do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

#Store request
case Cashier.store(card, [billing_address: address]) do
    {:ok, result}     -> IO.inspect result
    {:error, reason}  -> IO.inspect reason
end

#Unstore request
case Cashier.unstore("<card_id>") do
    :ok               -> IO.puts "card unstored"
    {:error, reason}  -> IO.inspect reason
end

Todo

All current todo items are listed on the issues page.

Please add any issues, suggestions or feature requests to this page.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].