Code Monkey home page Code Monkey logo

paytrace_ruby's Introduction

PayTrace Ruby SDK

Build Status

This gem integrates with the PayTrace API. It provides functionality to the publicly available functionality including:

  • Processing Transactions
  • Creating Customers
  • Exporting Transaction or Customer Data

Note that the gem is intended to be a "thin shim" around the public API, cleaning up and organizing the URL-based function calls. It is designed to be consumed by other code for payment processing.

Installation

Add this line to your application's Gemfile:

gem 'paytrace'

And then execute:

$ bundle

Or install it yourself as:

$ gem install paytrace

Usage

Configuring your account

You can set this up as a Rails initializer or during any other common configuration of your application.

PayTrace.configure do |config|
    config.user_name = "my_user_name"
    config.password = "password"
end

Transactions

Transactions can be processed utilizing class methods on the PayTrace::Transaction class. A simple example:

response = Transaction.sale(
    {
      amount: "1.00",
      card_number: "1111222233334444",
      expiration_year: 14,
      expiration_month: 3
    }
  }
)

#
## Response information is available on the transaction
#
puts response.get_response() # 101. Your transaction was successfully approved.

#
## All values returned are accessible through the response
#
response.values do |key, value|
    puts key      # e.g. APPCODE
    puts value    # TAS671
end

Customers

# running a transaction for a customer
Transaction.sale({amount: "1.00",customer: my_customer_id})

Some Optional Fields

#Adding Optional Fields

Transaction.Sale(
  {
    amount: "1.00",
    card_number: "1111222233334444",
    expiration_year: 14,
    expiration_month: 3,
    email:"[email protected]",
    description:"This is a test",
    tax_amount:".50",
    discretionary_data: {hair_color: "red"}
  }
)

Billing and Shipping Address

Transaction.Sale(
    {
      amount: "1.00",
      card_number: "1111222233334444",
      expiration_year: 14,
      expiration_month: 3,  
      billing_name:"Jane Doe",
      billing_address:"1234 happy st.",
      billing_address2:"apt#2",
      billing_city:"Seattle",
      billing_state:"WA",
      billing_country: "US",
      billing_postal_code:"98107"
    })

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

paytrace_ruby's People

Contributors

tredfern avatar quachj avatar ahatch1490 avatar

Watchers

James Cloos avatar James Blair avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.