GithubHelp home page GithubHelp logo

motdotla / virtualmerchant-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leequarella/virtualmerchant-ruby

0.0 2.0 0.0 121 KB

Ruby Gem for processing credit cards with VirtualMerchant

Ruby 100.00%

virtualmerchant-ruby's Introduction

A gem for processing credit cards with VirtualMerchant's API.

Setup

Add it to your Gemfile then run bundle to install it.

gem "virtual_merchant"

Usage

    #Create CreditCard via manual entry
    cc = VirtualMerchant::CreditCard.new(
      name_on_card: <name_on_card>,
      number: <card_number>,
      expiration: <card_exp>,
      security_code: <cvv2>)

    # OR
    # via MSR
    cc = VirtualMerchant::CreditCard.new(
      swipe: <swipe_data>)

    amount = VirtualMerchant::Amount.new(
      total: <total amount to charge>,
      tax: <amount of tax included in the total, optional>)

    creds = VirtualMerchant::Credentials.new(
      account_id: <vm_account_id>,
      user_id: <vm_user_id>,
      pin: <vm_user_pass>,
      demo: <boolean, optional>,
      referer: <uri of the http referer, optional>)

    response = VirtualMerchant.charge(cc, amount, creds)

The response returned is a VirtualMerchant::Response object.

If the transaction was sucessful and the card was approved, the response will have the following attrs:

* result_type: "approval"
* result_message: ssl_result_message
* result: ssl_result
* approval_code: ssl_approval_code
* blurred_card_number: ssl_card_number
* exp_date: ssl_exp_date
* cvv2_response: ssl_cvv2_response
* transaction_id: ssl_txn_id
* transaction_time: ssl_txn_tim
* approved: true

Otherwise there was some problem with the transaction, so the response will have these attrs:

* result_type: "error"
* error: errorCode
* result_message: errorMessage
* approved: false

For more information on the Virtual Merchant API, view their docs at https://www.myvirtualmerchant.com/VirtualMerchant/supportlandingvisitor.do

virtualmerchant-ruby's People

Contributors

motdotla avatar

Watchers

 avatar  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.