Skip to content

aonawale/paystack-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vapor Paystack Provider

Language GitHub license

Paystack is an easy to setup, complete payments solution for businesses.

Setup

Add the dependancy

Add PaystackProvider as a dependancy in your Package.swift file:

dependencies: [
  ...,
  .Package(url: "https://github.com/aonawale/paystack-provider.git", majorVersion: 1)]
]

Config

Paystack can be configured in a paystack.json file located inside your Vapor Config dir:

{
    "publicKey": "your public key",
    "secretKey": "your secret key"
}

Add the Provider

After you have initialized the Config object, simply add the provider:

import PaystackProvider
...
try config.addProvider(PaystackProvider.Provider.self)

Use

PaystackProvider adds an extension on Droplet for easier access to Paystack, so it can be accessed simply as:

let paystack = droplet.paystack

Charging a card

Send card details to start a charge:

import PaystackProvider

let card = Card(number: "4084084084084081", cvv: "408", expiryMonth: "02", expiryYear: "20")
try paystack.charge(card: card, amount: 1000, email: "me@email.com")

Releases

No releases published

Packages

No packages published

Languages