gringotts v0.0.2 Gringotts.Gateways.Paymill

An Api Client for the PAYMILL gateway.

For refernce see PAYMILL’s API (v2.1) documentation

The following features of PAYMILL are implemented:

ActionMethod
Authorizeauthorize/3
Capturecapture/3
Purchasepurchase/3
Voidvoid/2

Following fields are required for config

Config ParameterPAYMILL secret
private_keyyour_private_key
public_keyyour_public_key

Your application config must include ‘private_key’, ‘public_key’

config :gringotts, Gringotts.Gateways.Paymill,
  adapter: Gringotts.Gateways.Paymill,
  private_key: "your_privat_key",
  public_key: "your_public_key"

Link to this section Summary

Functions

Authorize a card with particular amount and return a token in response

Capture a particular amount with authorization token

Purchase with a card

Validates the config dynamically depending on what is the value of required_config

Voids a particular authorized amount

Link to this section Functions

Link to this function authorize(amount, card_or_token, options)
authorize(number(), String.t() | Gringotts.CreditCard, Keyword) :: {:ok | :error, Gringotts.Response}

Authorize a card with particular amount and return a token in response

Example

amount = 100

card = %CreditCard{
  first_name: "Sagar",
  last_name: "Karwande",
  number: "4111111111111111",
  month: 12,
  year: 2018,
  verification_code: 123
}

options = []

iex> Gringotts.authorize(:payment_worker, Gringotts.Gateways.Paymill, amount, card, options)
Link to this function capture(authorization, amount, options)
capture(String.t(), number(), Keyword) :: {:ok | :error, Gringotts.Response}

Capture a particular amount with authorization token

Example

amount = 100

token = "preauth_14c7c5268eb155a599f0"

options = []

iex> Gringotts.capture(:payment_worker, Gringotts.Gateways.Paymill, token, amount, options)
Link to this function purchase(amount, card, options)
purchase(number(), Gringotts.CreditCard, Keyword) :: {:ok | :error, Gringotts.Response}

Purchase with a card

Example

amount = 100

card = %CreditCard{
  first_name: "Sagar",
  last_name: "Karwande",
  number: "4111111111111111",
  month: 12,
  year: 2018,
  verification_code: 123
}

options = []

iex> Gringotts.purchase(:payment_worker, Gringotts.Gateways.Paymill, amount, card, options)
Link to this function validate_config(config)

Validates the config dynamically depending on what is the value of required_config

Link to this function void(authorization, options)
void(String.t(), Keyword) :: {:ok | :error, Gringotts.Response}

Voids a particular authorized amount

Example

token = "preauth_14c7c5268eb155a599f0"

options = []

iex> Gringotts.void(:payment_worker, Gringotts.Gateways.Paymill, token, options)