Coder Social home page Coder Social logo

samuel52 / paystackrubyapi Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 51 KB

:moneybag: :money_with_wings: Paystack Gem for Ruby API Applications

Home Page: https://paystack.com

License: MIT License

Ruby 99.17% Shell 0.83%
payment-gateway api paystack nigeria-payment-gateway money-transfer ruby-library

paystackrubyapi's Introduction

Paystackapi ๐Ÿ’ฐ

CircleCI Gem Version

Paystack gem for Ruby api only application

Installation

Simply add this line to your application's Gemfile:

gem 'paystackapi'

And then execute:

 bundle install

Or install it yourself as:

gem install paystackapi

Usage

You may need to install Dotenv to set you environmental variables. Set the requirements in your controller files where needed.

require 'paystackapi'
require 'dotenv/load'

Transactions ๐Ÿ’ณ

Verify Payment
def validate_payment
 paystack_ref = params[:reference_code] # get payment ref after initializing payment from the frontend
 verify = Paystackapi::PaystackTransactions.verify(paystack_ref)
end
Other Transaction Methods ๐Ÿ‘‡
 Paystackapi::PaystackTransactions.list # list all transactions
 Paystackapi::PaystackTransactions.totals # show transaction totals
 Paystackapi::PaystackTransactions.list_single(arg) # list single transaction
 Paystackapi::PaystackTransactions.charge(arg) # charge authorization from card

Customers ๐Ÿ‘ฌ

def customers
 customerEmail =  params[:customer_email]
 customer = Paystackapi::PaystackCustomers.create(customerEmail)
end
Other Customer Methods
 Paystackapi::PaystackCustomers.list #list all customers
 Paystackapi::PaystackCustomers.list_single(arg) #get by id

Plans ๐ŸŒ€

def plans
  createPlan = {
	CustomerName = params[:name]
	interval = params[:interval]
	amount = params[:amount]
  }
  customer = Paystackapi::PaystackPlans.create(createPlan)
end
Other Plans Methods
 Paystackapi::PaystackPlans.list #list all paystack plans
 Paystackapi::PaystackPlans.list_single(arg) #get by id
 Paystackapi::PaystackPlans.update(arg) #update plan by id

Subscription ๐Ÿ”Œ

def subscription
  createSub = {
	CustomerToken = "CUS_xnxdt6s1zg1f4nx"
	planCode = "PLN_gx2wn530m0i3w3m"
  }

customer = Paystackapi::PaystackSubscription.create(createSub)
end
Other Subcription Methods
 Paystackapi::PaystackSubscription.list #list all subs
 Paystackapi::PaystackSubscription.list_single(arg) #get subs by id
 Paystackapi::PaystackSubscription.disable #disable subs
 Paystackapi::PaystackSubscription.enable #enable subs

Paystack Transfer ๐Ÿ’ฅ

def transfer
  createTrans = {
   type = "nuban" #use params[:something] to get the parameters from your endpoint
   name = "Raz"
   description = "Razite"
   account_number = "01000000419"
   bank_code = "044"
   currency = "NGN"
  }
  transfer = Paystackapi::PaystackTransfer.generate(createTrans)
end
Other Transfer Methods
 Paystackapi::PaystackTransfer.list_reciept #list all transfers Reciept
 Paystackapi::PaystackTransfer.update_reciept(arg, arg) #update reciept 
 Paystackapi::PaystackTransfer.initailize(arg) #initalize a transfer (triggers an otp here)
 Paystackapi::PaystackTransfer.list_transfer #list all transfers
 Paystackapi::PaystackTransfer.finalize(arg) #finalize a transfer

Bank List ๐Ÿฆ

Paystackapi::PaystackBank.list_banks #list all Nigerian Banks

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

Who are you?

I'm Sam, find me on twitter.

License

The gem is available as open source under the terms of the MIT License.

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.