0.0
No commit activity in last 3 years
No release in over 3 years
This gem will be used mostly for ruby api only apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0

Runtime

~> 2.6
~> 0.16.3
~> 2.1, >= 2.1.2
 Project Readme

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.