gringotts v0.0.2 Gringotts.Gateways.AuthorizeNet
A module for working with the Authorize.net payment gateway.
The module provides a set of functions to perform transactions via this gateway for a merchant.
To use this module you need to create an account with the Authorize.net gateway which will provide you with a
name
and a transactionKey
. You will need to configure these keys to use the module
functions.
The following set of functions have been provided for a transaction:
Action | Description |
|
Authorize | To authorize the bank to charge the account and use it for payment. | |
Capture | To capture the given amount from an account for which, the | |
transaction has already been authorized. | ||
Purchase | To charge the account of a customer and transfer the funds to merchants | |
account. | ||
Refund | To refund a settled transaction from the merchant to the customer account. | |
void | To void a transaction before the transaction is settled at merchant’s side. | |
store | To store customer payment profile data. | |
unstore | To remove the customer payment profile data. |
Link to this section Summary
Functions
Authorize a credit card transaction
Capture a transaction
Charge a credit card
Refund amount
for a settled transaction referenced by id
Store a customer payment profile
Remove a customer profile from the payment gateway
Validates the config dynamically depending on what is the value of required_config
To void a transaction
Link to this section Functions
authorize(Float, Gringotts.CreditCard, Keyword) :: Tuple
Authorize a credit card transaction.
Function to authorize a transaction for the specified amount. It needs to be followed up with a capture transaction to transfer the funds to merchant account.
Required fields :
opts = [config: %{name:"", transactionKey: ""}] taken from the configuration in your
application
Optional Fields
opts = [order: %{invoiceNumber: ,description: },
refId: ,
lineitems: %{itemId: , name: , description: , quantity: , unitPrice: },
tax: %{amount: , name: ,description: },
duty: %{amount: , name: ,description: },
shipping: %{amount: , name: ,description: },
poNumber: ,
customer: %{id: },
billTo: %{firstName: ,lastName: ,company: ,address: ,city: ,state: ,zip: ,country: },
shipTo: %{firstName: ,lastName: ,company: ,address: ,city: ,state: ,zip: ,country: },
customerIP: ]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
refId: "123456",
order: %{invoiceNumber: "INV-12345", description: "Product Description"},
lineItem: %{itemId: "1", name: "vase", description: "Cannes logo", quantity: "18", unitPrice: "45.00" }
]
card = %CreditCard{number: "5424000000000015", year: 2020, month: 12, verification_code: "999"}
amount = 5
Capture a transaction.
Function to capture an amount
for an authorized transaction.
Required fields :
opts = [config: %{name:" ", transactionKey: " "}, ] taken from the configuration in your
application
Optional Fields
opts = [order: %{invoiceNumber: ,description: },
refId: ]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
refId: "123456",
order: %{invoiceNumber: "INV-12345", description: "Product Description"}
]
id = "transId of the authorize response"
amount = 5
purchase(Float, Gringotts.CreditCard, Keyword) :: Tuple
Charge a credit card.
Function to charge a user credit card for the specified amount. It performs authorize and capture at the same time.
Required fields :
opts = [config: %{name:"", transactionKey: ""}]` taken from the configuration in your
application
Optional Fields
opts = [order: %{invoiceNumber: ,description: },
refId: ,
lineitems: %{itemId: , name: , description: , quantity: , unitPrice: },
tax: %{amount: , name: ,description: },
duty: %{amount: , name: ,description: },
shipping: %{amount: , name: ,description: },
poNumber: ,
customer: %{id: },
billTo: %{firstName: ,lastName: ,company: ,address: ,city: ,state: ,zip: ,country: },
shipTo: %{firstName: ,lastName: ,company: ,address: ,city: ,state: ,zip: ,country: },
customerIP: ]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
refId: "123456",
order: %{invoiceNumber: "INV-12345", description: "Product Description"},
lineItem: %{itemId: "1", name: "vase", description: "Cannes logo", quantity: "18", unitPrice: "45.00" }
]
card = %CreditCard{number: "5424000000000015", year: 2020, month: 12, verification_code: "999"}
amount = 5
Refund amount
for a settled transaction referenced by id
.
Use this method to refund a customer for a transaction that was already settled, requires transId of the transaction.
Required fields
opts = [config: %{name:" ", transactionKey: " "}, payment: %{card: %{number: ,year: , month:}}]
Optional fields
opts = [refId: ]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
payment: %{card: %{number: "5424000000000015", year: 2020, month: 12}}
refId: "123456",
]
id = "trans id of the transaction to be refunded"
amount = 5
Store a customer payment profile.
Use this function to store the customer card information by creating a customer profile, and in case the customer_profile_exists with gateway then by creating customer payment profile.
Required Fields
opts = [config: %{name:" ", transactionKey: " "},
profile: %{merchantCustomerId: ,description: ,email: }
]
Optional Fields
opts = [
validationMode: , # testMode, liveMode
billTo: %{firstName: ,lastName: ,company: ,address: ,city: ,state: ,zip: ,country: },
customerType: ,
customerProfileId:
]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
profile: %{merchantCustomerId: 123456 ,description: "test store",email: "test@gmail.com"},
validationMode: 'testMode'
]
card = %CreditCard{number: "5424000000000015", year: 2020, month: 12, verification_code: "999"}
Remove a customer profile from the payment gateway.
Use this function to unstore the customer card information by deleting the customer profile present. Requires the customer profile id.
Required Fields
opts = [config: %{name:" ", transactionKey: " "},
customerProfileId:
]
Validates the config dynamically depending on what is the value of required_config
To void a transaction
Use this method to cancel either an original transaction that is not settled or
an entire order composed of more than one transaction. It can be submitted against
any other transaction type. Requires the transId
of a transaction passed as id
.
Required Fields
opts = [config: %{name:" ", transactionKey: " "}]
Optional fields
opts = [refId: ]
Example
opts = [config: %{name: "your_name", transactionKey: "your_key"},
refId: "123456",
]
id = "trans id of the transaction to be void"