Project

netaxept

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
This gem simplifies the comunication with the netaxept service significantly. Right now it only supports register and sale, more is to come.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

~> 0.7
 Project Readme

Installation

run

gem install netaxept

or include in your Gemfile:

gem 'netaxept'

Usage

First step is to tell Netaxept your credentials and the desired mode:

Netaxept::Service.authenticate <merchant id>, <token>
Netaxept::Service.environment =  :test|:production

To interact with Netaxept you need to create an instance of Netaxept::Service:

service = Netaxept::Service.new

General

Every request returns a Netaxept::Response object, which has a success? method. In case of an error you can call errors, which gives you a list of Netaxept::ErrorMessages (each with a message, code, source and text).

Off-site payment workflow

The following applies for the Nets hosted service type where the user is redirect to the Netaxept site to enter her payment details (see the Netaxept docs for details).

Registering a payment

service.register <amount in cents>, <order number>, <options>

Required options are CurrencyCode (3 letter ISO code) and redirectUrl.

On success the response object gives you a transaction_id. You pass that to Netaxept::Service.terminal_url(<transaction id>) to get the URL for redirecting the user.

For details on the options see http://www.betalingsterminal.no/Netthandel-forside/Teknisk-veiledning/API/Register/

Completing a payment

After the user has authorized the payment on the Netaxept site he is redirected to the redirectUrl you provided. Netaxept adds a resonseCode and transactionId parameter to the URL. To finalize the payment you call sale on the service.

service.sale <transaction id>, <amount in cents>

The response is a Responses::SaleResponse which only has the success? and errors methods mentioned under General.

Congratulations, you have processed a payment.

Testing

To run the tests:

$ bundle
$ rake MERCHANT_ID=<your merchant id> NETAXEPT_TOKEN=<your token>