Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

PxPay Build Status

======= A Rubygem to integrate DPS-hosted payments through the Payment Express PxPay system.


To integrate with the PxPay 2.0 you simply need to change the default URL to the new endpoint.

Pxpay::Base.pxpay_request_url = ''

For self-hosted systems check out the amazing ActiveMerchant gem.

See or for more details about PxPay.


Install from Rubygems

gem install pxpay

Then run rails generate pxpay:install to copy an initializer to your rails app. Make sure you add your own development credentials to the config/initializers/pxpay.rb file You can apply for a development account at


>> require 'nokogiri'
>> require 'pxpay'
>> request = 1, 12.00, {:url_success => '', :url_failure => ''})
=> #<Pxpay::Request:0x00000101c9a840 >
>> request.url
=> ""

To send your customer to Payment Express for payment make a call to Pxpay::Request to request a redirection URL

def create
  request = id , price, options )
  redirect_to request.url

Once your customer has entered their details Payment Express will redirect them back to the success URL that you provided.

Use Pxpay:Response to get the transaction details back from Payment Express.

def success
  response =
  hash = response.to_hash
  ## Do something with the results hash

N.B. There is a minor caveat here: Payment Express includes a system called fail-proof result notification where as soon as the customer has finished the transaction they will send a background request.

This means your success/failure URL will be hit at least twice for each transaction, so you must allow for this in your code. See for details.

Token Billing can be implemented by setting :token_billing => true inside the Request option hash.


The source of most non-gem related errors comes from the fact that Payment Express caches the details of a transaction with the ID given. If you are having problems with the wrong price being charged or an invalid card type error make sure you are sending a unique ID through with each transaction.

This gem is in no way endorsed or affiliated with Payment Express


  • Add ability to set global configuration options
  • Add more tests

Contributing to PxPay

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright (c) 2012 Bradley Priest. See LICENSE.txt for further details.


A Ruby wrapper around the Payment Express(DPS) PxPay system API







No packages published