GithubHelp home page GithubHelp logo

repay_rest_client's Introduction

Repay Rest Client

This gem will allow us to make requests to the Repay rest API from any project quickly

Installation

Add this line to your application’s Gemfile:

$ gem 'repay-rest-client-ruby', :git => 'https://github.com/ldstudios/repay_rest_client.git'

And then execute:

$ bundle

Usage

Acquire an ach_token

$ Repay::AchToken.new(customer_id, account_holder_name, routing_number, account_number, zip_code).ach_token

e.g.

$ Repay::AchToken.new("123", "Rick Sanchez", "121202221", "1234567812345678", "30506").ach_token

result will just be a string containing the ach_token returned from the API

  • you must have the following environment variables set:

    • REPAY_API_TOKEN

    • REPAY_REST_BASE

    • REPAY_SAVE_ACH_FORM_ID

    • REPAY_USE_STORED_ACH_FORM_ID

  • successful result should just be a string containing the ach_token returned from the API

  • unsuccessful result will be simply nil

Use an ach_token to post payment

$ Repay::AchTokenPayment.new(ach_token, customer_id, amount).payment

e.g.

$ Repay::AchTokenPayment.new("5068", "123", "2.22").payment

successful result will be a ruby hash parsed from JSON similar to this: “‘ruby

{"auth_code"=>"DEMO323",
 "details"=>nil,
 "message"=>"Approved - DEMO",
 "pn_ref"=>"148595274",
 "receipt_id"=>"148595274.VHJ9-OHFqYAelhdit-HmPPEKBtExcV3RMxlTEcZNL8jXZTXEKqVAI8kWx0-DqjvvTvyH0m1rzYRkfOBJ94SxHw",
 "description"=>nil,
 "code"=>"OK",
 "error"=>"APPROVED",
 "payment_method_detail"=>
  {"gateway_mid"=>"8638", "routing_number"=>"121202221", "bank_name"=>"", "name_on_check"=>"Jerry Smith", "account_last_four"=>"1812", "ach_account_type"=>"Checking"},
 "success_data"=>[],
 "result"=>"0"}

“‘

unsuccessful result will be a ruby hash parsed from json similar to this: “‘ {“status”=>“error”, “errors”=>[{“description”=>“Decline - DEMO - ResultCode: 12 - AuthCode: ”, “name”=>“12”, “location”=>“gateway_error”}]} “`

  • you must have the following environment variables set:

    • REPAY_API_TOKEN

    • REPAY_REST_BASE

  • amount must be an even number when using a test repay setup

License

The gem is available as open source under the terms of the [MIT License](opensource.org/licenses/MIT).

repay_rest_client's People

Contributors

jarblz avatar danielricecodes avatar dependabot[bot] avatar

Watchers

 avatar James Cloos avatar Ryan Chew 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.