DEV Community

Cover image for Paynow Integration Part 3: Installation
Takunda Madechangu
Takunda Madechangu

Posted on

Paynow Integration Part 3: Installation

In the last tutorial we got keys from PayNow, in this one we will go through installation of Paynow SDK in PHP based projects.
I will touch on these scenarios:

  • Composer
  • Manual Installation

Also make sure curl extension is enabled in your PHP

1. Composer

Type the following command to install paynow php sdk

$ composer require paynow/php-sdk
Enter fullscreen mode Exit fullscreen mode

Then include it in you project like this

<?php
require_once 'path/to/vendor/autoload.php';
// your code here
Enter fullscreen mode Exit fullscreen mode

If you are using Laravel include it like this

<?php
use \Paynow\Payments\Paynow;
// your code here
Enter fullscreen mode Exit fullscreen mode

Thats it!

2. Manual Installation

If you don't have composer installed then Download Paynow Here

Extract it into your project directory then type this into your code

<?php
require_once 'path/to/library/autoloader.php';
// Do stuff
Enter fullscreen mode Exit fullscreen mode

Example: Manual Installation

If your your folder structure is like this

- Paynow
- checkout.php
- success.php
- cart.php
Enter fullscreen mode Exit fullscreen mode

Then you include Paynow like this(inside checkout.php)

<?php
require_once './Paynow/autoloader.php';
Enter fullscreen mode Exit fullscreen mode

And BAM you have access to PayNow!!!

Congratulations we have finished the boring stages now we move to the interesting stuff

image

Top comments (0)