Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (30 sloc) 1.135 kb

ePDQ

ePDQ is a Ruby library for interfacing with Barclaycard's ePDQ payment gateway.

Usage

First, configure the EPDQ module for your settings:

EPDQ.pspid    = "foo"
EPDQ.sha_type = :sha1 # or :sha256, :sha512
EPDQ.sha_in   = "yourshainstring"
EPDQ.sha_out  = "yourshaoutstring"

Then you can build the form for a user to POST to, starting in the controller: All the options keys are named after the downcased fields in the ePDQ documentation, provided as symbols or strings.

parameters = {
  :amount => 1500,
  :currency => "EUR",
  :language => "en_US",
  :orderid => "1234"
}

@epdq_request = EPQD::Request.new(parameters)

Then in a Rails view, you might do something like this:

<%= form_tag @epdq_request.request_url do |f| %>
  <%- @epdq_request.form_attributes.each do |k, v| -%>
    <%= hidden_field_tag k, v %>
  <%- end -%>

  <%= submit_tag "Pay with a credit or debit card" %>
<%- end -%>

And voila, the form is generated with the correct values, including the SHASIGN field.

Jump to Line
Something went wrong with that request. Please try again.