Skip to content

samuel52/PaystackRubyApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published