gringotts v1.0.0 Gringotts.Gateways.Monei
An API client for the MONEI gateway.
For reference see MONEI’s API (v1) documentation.
The following features of MONEI are implemented:
type | Action | Method |
|---|---|---|
PA | Pre-authorize | authorize/3 |
CP | Capture | capture/3 |
DB | Debit | purchase/3 |
RF | Refund | refund/3 |
RV | Reversal | void/2 |
| Tokenization / Registrations | store/2 |
The opts argument
Most Gringotts API calls accept an optional Keyword list opts to supply
optional arguments for transactions with the MONEI gateway. The following keys
are supported:
| Key | Remark | Status |
|---|---|---|
billing_address | Not implemented | |
cart | Not implemented | |
currency | Implemented | |
customParameters | Not implemented | |
customer | Not implemented | |
invoice | Not implemented | |
merchant | Not implemented | |
shipping_address | Not implemented | |
shipping_customer | Not implemented |
MONEI quirks
- MONEI does not process money in cents, and the
amountis rounded to 2 decimal places.
Caveats
Although MONEI supports payments from various cards, banks and virtual accounts (like some wallets), this library only accepts payments by (supported) cards.
TODO
-
- Credit
- Rebill
- Recurring payments
- Reporting
Link to this section Summary
Functions
Performs a (pre) Authorize operation
Captures a pre-authorized amount
Makes the request to MONEI’s network
Transfers amount from the customer to the merchant
Refunds the amount to the customer’s account with reference to a prior transfer
Parses MONEI’s response and returns a Gringotts.Response struct in a :ok, :error tuple
Stores the payment-source data for later use
Validates the config dynamically depending on what is the value of required_config
Voids the referenced payment
Link to this section Functions
authorize(number(), Gringotts.CreditCard, keyword()) :: Gringotts.Response
Performs a (pre) Authorize operation.
The authorization validates the card details with the banking network,
places a hold on the transaction amount in the customer’s issuing bank and
also triggers risk management. Funds are not transferred.
MONEI returns an ID string which can be used to:
Note
A stand-alone pre-authorization expires in 72hrs.
capture(number(), String.t(), keyword()) :: Gringotts.Response
Captures a pre-authorized amount.
amount is transferred to the merchant account by MONEI when it is smaller or
equal to the amount used in the pre-authorization referenced by paymentId.
Note
MONEI allows partial captures and unlike many other gateways, does not release the remaining amount back to the payment source. Thus, the same pre-authorisation ID can be used to perform multiple captures, till:
- all the pre-authorized amount is captured or,
- the remaining amount is explicitly “reversed” via
void/2. [citation-needed]
commit(atom(), String.t(), keyword(), keyword()) :: {:ok, HTTPoison.Response} | {:error, HTTPoison.Error}
Makes the request to MONEI’s network.
purchase(number(), Gringotts.CreditCard, keyword()) :: Gringotts.Response
Transfers amount from the customer to the merchant.
MONEI attempts to process a purchase on behalf of the customer, by debiting
amount from the customer’s account by charging the customer’s card.
refund(number(), String.t(), keyword()) :: Gringotts.Response
Refunds the amount to the customer’s account with reference to a prior transfer.
MONEI processes a full or partial refund worth amount, referencing a
previous purchase/3 or capture/3.
The end customer will always see two bookings/records on his statement. Refer MONEI’s Backoffice Operations guide.
respond(term()) ::
{:ok, Gringotts.Response} |
{:error, Gringotts.Response}
Parses MONEI’s response and returns a Gringotts.Response struct in a :ok, :error tuple.
store(Gringotts.CreditCard, keyword()) :: Gringotts.Response
Stores the payment-source data for later use.
MONEI can store the payment-source details, for example card or bank details which can be used to effectively process One-Click and Recurring payments, and return a registration token for reference.
It is recommended to associate these details with a “Customer” by passing
customer details in the opts.
Note
- One-Click and Recurring payments are currently not implemented.
- Payment details can be saved during a
purchase/3orcapture/3.
WIP
MONEI unstore does not seem to work. MONEI always returns a 403
Deletes previously stored payment-source data.
Validates the config dynamically depending on what is the value of required_config
Voids the referenced payment.
This method attempts a reversal of the either a previous purchase/3 or
authorize/3 referenced by paymentId.
As a consequence, the customer will never see any booking on his statement. Refer MONEI’s Backoffice Operations guide.
Voiding a previous authorization
MONEI will reverse the authorization by sending a “reversal request” to the payment source (card issuer) to clear the funds held against the authorization. If some of the authorized amount was captured, only the remaining amount is cleared. [citation-needed]
Voiding a previous purchase
MONEI will reverse the payment, by sending all the amount back to the
customer. Note that this is not the same as refund/3.