/flutterwave

A simple Object Oriented PHP Client for Flutterwave API

Primary LanguagePHP

Flutterwave Client

A simple Object Oriented PHP Client for Flutterwave.

Uses Flutterwave API.

Requirements

  • PHP >= 7.2
  • Guzzlehttp ~6|~7

Installation

Via Composer.

PHP 7.2+:

This project is still in beta version and has not been upload to packagis

##Transactions

Get all transactions

https://developer.flutterwave.com/reference#get-all-transactions

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');

// $client->transaction->all();
$transactions = $client->transaction->all();

print_r($transactions);

Get transaction fee

https://developer.flutterwave.com/reference#get-transaction-fee

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');
/**
 * Get transaction fee
 * 
 * @since 1.0
 * 
 * @param Int $amount
 * @param string $currency
 * @param string $payment_type
 * @return array
 * 
 * $client->transaction->fee(int $amount, string $currency = 'NGN', string $payment_type = 'card') 
 */

$fee = $client->transaction->fee(10000);

print_r($fee);

Resend transaction webhook

https://developer.flutterwave.com/reference#resend-transaction-webhook

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');

/**
 * Resend transaction webhook
 * 
 * @since 1.0
 * 
 * @param Int $id
 * @return array
 *
 * $id - This is the transaction unique identifier.
 *
 * $client->transaction->resend_webhook(int $id)
 *
 */

$transaction = $client->transaction->resend_webhook(1000);

print_r($transaction);

Transaction refund

https://developer.flutterwave.com/reference#transaction-refund

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');

/**
 * initiate a transaction refund
 * 
 * @since 1.0
 * 
 * @param Int $id
 * @param Int $amount
 * @return array
 *
 * $client->transaction->refund(int $id, int $amount)
 *
 * $id - This is the transaction unique identifier.
 * $amount - amount.
 *
 */

$transaction = $client->transaction->refund(2069367, 50);

print_r($transaction);

Verify Transaction

https://developer.flutterwave.com/reference#verify-transaction

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');

/**
 * Verify transactions using the transaction ID
 * 
 * @since 1.0
 * 
 * @param Int $id
 *
 * @return array
 *
 * $client->transaction->verify(int $id)
 *
 * $id - This is the transaction unique identifier.
 * $amount - amount.
 *
 */

$transaction = $client->transaction->verify(2069367));

print_r($transaction);

View transaction timeline

https://developer.flutterwave.com/reference#get-transaction-events

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

use KayodeSuc\Flutterwave\Client;

// Create a new Client instance
$client = new Client('Your Api Key');

/**
 * View Transaction Timeline
 * 
 * @since 1.0
 * 
 * @param Int $id
 *
 * @return array
 *
 * $client->transaction->timeline(int $id)
 *
 * $id - This is the transaction unique identifier.
 *
 */

$transaction = $client->transaction->timeline(2069367));

print_r($transaction);