Skip to content

Setup SDK on CodeIgniter Project.

Abraham Olaobaju edited this page May 31, 2023 · 5 revisions

Steps to PHP SDK Integration with CodeIgniter 4

Configuration

Create a .env file as the package does not acknowledge the env file that ships with CodeIgniter 4. Ensure the following keys/value pairs are present in the .env file.

SECRET_KEY=FLWSECK_TEST-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X
PUBLIC_KEY=FLWPUBK_TEST-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X
ENCRYPTION_KEY=FLWSECK_TESTXXXXXXXXXX
ENV=staging

Installation via Composer.

Install the Software Development Kit via the command.

composer require flutterwavedev/flutterwave-v3

Initialization

Create a Controller to initiate a Payment in your App\Controllers directory. If you do not wish to store your keys in a .env file. you can review the wiki on how to setup custom configurations here.

<?php

namespace App\Controllers;

use Flutterwave\Flutterwave;
use Flutterwave\Util\Currency;
use App\ThirdParty\Flutterwave\Config; # use if you do not wish to use the .env file.
use App\ThirdParty\Flutterwave\EventHandler;

class PaymentController extends BaseController
{
  ...
}
Clone this wiki locally