GithubHelp home page GithubHelp logo

ecocash's Introduction

EcoCash Ruby Library

This library provides developers with convenient access to the EcoCash Instant Payments(EIP) API from applications written in Ruby. The EcoCash Online API provides functionality to receive payments directly on your website or easily refund transactions to your customers.

Documentation

See the Ruby API docs

Requirements

To use the EcoCash Online API, the following things are required:

  • Get yourself a Merchant account from EcoCash
  • Apply to be an Online Merchant(This is subject to approval)
  • Now you're ready to use EcoCash Online API
  • In order to accept payments in production mode, your integration will need to be verified by EcoCash.

Installing

This package is available in RubyGems and can be installed with:

gem install ecocash

Or import it to your Gemfile

gem 'ecocash'

Usage

require 'ecocash'

Values you will need from Ecocash

  • Username and password: These are credentials to authenticate the API
  • Merchant number, merchant code and pin: You change PIN on the time of activating your merchant number.

Configuration

The library uses a configuration block for easy setup:

Ecocash.configure do |config|
  config.api_base_url = ENV['API_BASE_URL']
  #Authentication
  config.username = ENV['USERNAME'] 
  config.password = ENV['PASSWORD'] 
  config.merchant_number =ENV['MERCHANT_NUMBER'] 
  config.merchant_code = ENV['MERCHANT_CODE'] 
  config.merchant_pin = ENV['MERCHANT_PIN'] 
  #Payment information
  config.description = "Payment description"
  config.on_behalf_of = "Service description"
  config.payment_remarks = "Transaction description"
  config.reference_code = "Transaction reference"
  config.purchase_category_code = "Online Payment"
  config.refund_remarks = "Refund transaction description"
  #Merchant details
  config.super_merchant_name = ENV['SUPER_MERCHANT_NAME'] 
  config.merchant_name = ENV['MERCHANT_NAME'] 
  config.terminal_id = "unique identifier"
  config.location = "your business physical location"
  config.notify_url = ENV['YOUR_CALLBACK_URL'] 
  
  config.currency_code = "USD"
  config.country_code = "ZW"
  #Client Correlator Prefix
  config.client_correlator_prefix = "any letter(up to 7) to prefix your client correlator"
end

Initialize the API client

client = Ecocash::Client.new

Charge Subscriber

client.charge_subscriber('subscriber_mobile_number','amount')

Refund Subscriber

client.transaction_reversal('subscriber_mobile_number','transaction_id','amount')

Transaction Status

client.transaction_status('subscriber_mobile_number','client_correlator')

List Subscriber Transactions

client.list_transactions('subscriber_mobile_number')

API Documentation

The API document can be obtain from EcoCash upon approval of your application.

Contributing

Please read CONTRIBUTING.md for details and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details

ecocash's People

Contributors

tusomx avatar dependabot[bot] 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.